Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
On Key Label problems
Message
From
25/02/2007 17:56:00
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01198638
Message ID:
01198693
Views:
7
>Hi.
>I want to set a screen level On Key label, so that the user can hit a Function key to carry out a particular option.
>I have code in the init like:
>On Key Lablel F4 Thisform.MyMethod and I have a Method as:
>
>** MyMethod ****
>Take Some Action
>
>(Note that MyMethod is also called from other controls within the form)
>
>I get a Thisform can only be used within a Method.

I'd go with one of the offered solutions - menu being the preferred one, except that you'd actually have to check whether .activeform is actually an object, because it's not necessarily an object every time you try - suppose there are no active forms, or that the active form may be something that doesn't have MyMethod.

The reason you are getting the error via OKL is that the OKL code fires in its own context, pretty much as a script run in the command window, so it's not a method of any form, and Thisform has no meaning in that context. It's also probably running in the default datasession (or at least you can't safely assume any particular DS). OKL was a nice, albeit a somewhat wild tool in 2.x - in an event driven architecture, it's more wild than nice.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform