Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Object Problems
Message
From
23/04/1998 22:37:15
 
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00094531
Message ID:
00094572
Views:
26
>Hi,
>
>Here's how my app is currently set up:
>
>It is run with root.prg which sets up some variables and the default directory, etc. Then a form is run with DO FORM MAIN.SCX and things are set in motion with READ EVENTS. If you click the Search button on the MAIN form, it is RELEASEd and the search form is run with DO FORM SEARCH.SCX.
>
>In the Activate event I have:
> PUSH KEY CLEAR
> ON KEY LABE F1 SEARCH.NAM.SETFOCUS
>
>In other words, I want the F1 key to jump to the NAM field on the form. This works fine if I run the form alone, but when it's called by MAIN, I get an error saying that there's no object named SEARCH. Sure enough, when I look in the debugger, there is no such object. What am I doing wrong?
>
> All help appreciated,
> Rob

On Key Labels are generally a bad idea for this type of thing because they are interprocess commands, meaning they will interrupt any running code to executet their duties. This (as you might well guess) can cause really unpredictable behavior. Instead, use the form.keypress event. To do this, you first have to set form.keypreview to .T. and add the code in the keypress event (after the parameter statement:

if nKeyCode = 28 &&F1
thisform.NAM.SETFOCUS
endif
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform