Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programming function keys
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00052580
Message ID:
00056738
Views:
34
>>>>When you are done redefining a key, issue and ON KEY LABEL without a command...this will cause the key to behave with its default behaviour...
>>>>
>>>>Joe
>>>>
>>>>>>>When i'm on a form, when i push the function keys, i want the following to happen:
>>>>>>>
>>>>>>>pressing F2 = append new record
>>>>>>> F4 = delete record
>>>>>>> F5 = skip back
>>>>>>> F6 = skip forward
>>>>>>> F7 = goto bottom
>>>>>>> F8 = goto top
>>>>>>>etc. ...
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>I've tried somethings already, but wtih no luck.
>>>>>>>
>>>>>>>How do i do it ??
>>>>>>>
>>>>>>>
>>>>>>>Greating, Marc
>>>>>>
>>>>>>have you tried using ON KEY LABEL F4 ....
>>>>>
>>>>>Thanks already,
>>>>> Doing it this way, is the ON KEY LABEL .... always active ?
>>>>>I want it to be actice in some form, inactive on others
>>>>>
>>>>>Marc
>>>
>>>You can use PUSH KEY/POP KEY commands.
>>
>>The way that I have dealt with this is issue ON KEY LABEL blah blah blah in the form.activate and issue ON KEY LABEL in the form.deactivate. This way each form provides for and cleans up after itself. Edward- how many different sets of ON KEY LABEL settings will PUSH/POP key provide for?
>
>I just meant that you can add e.g. PUSH KEY in Activate event and POP KEY in Deactivate event to save/restore previous (might be not default too) setting. If you want to set new settting then, right, you use ON KEY LABEL.

Marc:

If you're using function keys quite often (as I do) you may consider adding a method to your base form class: FKeys()

Include the following In your startup code:

ON KEY LABEL F4 =TrapFKeys()
ON KEY LABEL F6 =TrapFKeys()
ON KEY LABEL F7 =TrapFKeys()
ON KEY LABEL ALT+S =TrapFKeys()
.
.
.


PROCEDURE TrapFKeys
IF TYPE('_screen.ActiveForm') = 'O'
_screen.ActiveForm.Fkeys(LASTKEY())
ENDIF

In each Form you have the ability to structure CASE statements specific to the active form (you can place default behavior for a common function key in the base class and benefit from inheritance). Placing the procedure FKEYS in your startup code makes it accessible by the entire application.

* Form.FKeys()
LPARAMETERS nKeyCode
DO CASE


ENDCASE

nKeyPress = LASTKEY()

DO CASE
Dan
St. Petersburg, FL

"I started out with nothing and I still have most of it left"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform