Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Barbara Peisch
  Where is Barbara Peisch?
 Oceanside
 California - United States
 Barbara Peisch
 To: Al Klapperich
  Where is Al Klapperich?
 Ripon, WI
 Wisconsin - United States
 Al Klapperich
 Tags
Subject: RE: access keys
Thread ID: 104592 Message ID: 104681 # Views: 2 # Ratings: 0
Version: Visual FoxPro 8 Category: Forms
Date: Saturday, August 19, 2006 6:17:55 AM         
   


> Hi Gang,
>
> I in my forms, I have access keys defined for many of the buttons (N for Next, P for Previous, etc). I have [had? ;-)] the understanding that, you need to press the ALT key in order to activate them [Alt-N, Alt-P, etc]. Testing recently shows that I can press N, P, etc to carry out those function [if focus is NOT in a text box or a grid]. If focus is set to the Add button, I can press the N and my form will display the next record in the table.
>
> Obviously I don't want it to function that way. Any ideas?
>
> Thanks much!!


I would just look at LASTKEY() in each button's Click method to make sure the Alt key was used to get you there. Look in the help under INKEY() to find the codes you need, but as an example, put this in the Add button's Click:
IF LASTKEY() = 30
   WAIT WINDOW "I'm adding"
ELSE
   NODEFAULT 
ENDIF 

And this in the Delete button's Click:
IF LASTKEY() = 32   WAIT WINDOW "I'm deleting"
ELSE
   NODEFAULT 
ENDIF 

This won't work with the mouse, though. You could set a flag that you check in the MouseEnter method of each button and check for that flag too. Don't forget to set the flag back in the MouseLeave method.

It's kind of kludgey, but you're trying to go against the way Windows naturally works.

-BP
www.peisch.com

ENTIRE THREAD

access keys Posted by Al Klapperich @ 8/17/2006 11:33:14 PM
RE: access keys Posted by Jim Winter @ 8/18/2006 12:43:41 PM
RE: access keys Posted by Al Klapperich @ 8/18/2006 4:45:19 PM
RE: access keys Posted by Ken Murphy @ 8/18/2006 2:06:22 PM
RE: access keys Posted by Al Klapperich @ 8/18/2006 4:40:29 PM
RE: access keys Posted by Ken Murphy @ 8/18/2006 6:26:21 PM
RE: access keys Posted by Al Klapperich @ 8/18/2006 7:05:16 PM
RE: access keys Posted by Ken Murphy @ 8/18/2006 7:28:19 PM
RE: access keys Posted by Barbara Peisch @ 8/19/2006 6:17:55 AM