>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.