Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
On key label in forms
Message
From
24/09/1998 23:44:43
 
 
To
24/09/1998 23:14:57
Sudhir Arora
Userease Software Pvt. Ltd.
New Delhi, India
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00140676
Message ID:
00140687
Views:
34
>How can on key label command be used in forms ? When I write following commands in Load event of the form :
>on key label Ctrl+A thisform.pageframe1.page1.command1.click() ;
>an error message "Thisform can only be used within a method" appears.

There is a simple rule to remember when using On Key Label with forms:
Don't ever do it.

To perform an action in a form when a user presses a certain key combination, intercept the key in the form.KeyPress event.
Form.KeyPress()
LPARA nKeyCode, nShiftAltCtrl

IF nKeyCode = ASC('A') and nShiftAltCtrl = 2
    NODEFAULT
    thisform.pageframe1.page1.command1.click()
ENDIF
For this code to work form-wide, the form KeyPreview property must be set to .T.
hth
Erik Moore
Clientelligence
Previous
Reply
Map
View

Click here to load this message in the networking platform