Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I _Need_ OKLs!
Message
From
03/07/1999 11:24:44
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
02/07/1999 21:10:54
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00237087
Message ID:
00237206
Views:
13
Harry: No_you_don't.

>>on key label F9 THISFORMSET.HOTKEY.CHOOSEGO.CLICK()
>>
>>Trouble is, when I run it, and press F9, I get 'object "HOTKEY" not found - even though wexist says its alive and well.
>>
>
>You can't use stuff like THIS, THISFORM, and THISFORMSET in an OKL- those keywords only have scope inside an object method, and OKL routines are not methods. I don't use formsets, so I can't help you there, but if it were a form, oyu could call a routine that loops through _SCREEN.Forms looking for your form and call the method that you got from that object reference
>
>ON KEY LABEL F9 DO RunFormMethod
>
>PROCEDURE RunFormMethod
>FOR EACH oForm IN _SCREEN.Forms
>IF oForm.Name = "MyForm"
>oForm.SomeControl.SomeMethod()
>ENDIF
>ENDFOR
>
>Keep in mind, I still don't approve of the use of OKL here... :-)

And it's even not necessary. There's actually no need to parse the _screen's forms, and testing for oForm.Name = "MyForm" may find MyForm2" before MyForm (depending on ordering of forms in _screen.forms), so it would need more precise testing, taking care of form's names etc etc. Really no need for that.

The form can solve it by itself. It should have .KeyPreview=.t., and form's keypress should check for F9, like this:

nodefault

do case
... < other cases here >
case nKeyCode=-8 && if I'm not mistaken, this should be the keycode for F9
ThisFormSet.Hotkey.ChooseGo.Click
Otherwise
dodefault(nKeyCode, nShiftAltCtrl)
endcase

Disclaimer: I was an OKL addict once, and I'm cured. Feel much better now.

back to same old

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

Click here to load this message in the networking platform