Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where to store form related procedures
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00247602
Message ID:
00247807
Views:
17
>The KeyPress event worked great...one problem. I'm trapping ENTER, so that when my user types some text in a text box (mytext), then presses enter. ENTER via the KeyPress method calls another method. But when the method is called thisform.mytext is empty. I guess the form has not saved the data to mytext yet. Is there a way to save what's in the text box before continuing?
>

You'd have to save the content of the TextBox's Value property back to the control source, so that when contrl is returned, the textbox isn't refreshed from the old control source value.

>Thanks for your help!
>
>>>The problem I'm having is I'm trying to call my procedure from an ON KEY LABEL command.
>>>
>>>I've tried putting in the init method: ON KEY LABEL ENTER thisform.mymethod
>>>
>>
>>Rather than an OKL, maybe you shoudl try trapping the Enter key in the Form's KeyPress() event, or better, in the controls on the form that this applies to.
>>
>>>but it won't let me use any thisform type references from ON KEY LABEL.
>>>
>>>I then tried
>>>
>>>oThisForm=thisform
>>>ON KEY LABEL ENTER oThisForm.mymethod
>>>And that did not work either...
>>>
>>>Any ideas? Thanks!
>>>
>>>>>This will show my ignorance, but how do I get the reference to my form (oForm) from within my form?
>>>>
>>>>When you pass thisform as an argument to the function, it passes the form object reference. Anywhere that you would want to use a reference in the format thisform.something, you'd use the parameter that received the object reference (in this case, from Walter's example, where thisform is the third parameter passed, and oForm is the third parameter entry in the procedure, oForm) ie oForm.something
>>>>
>>>>>>
>>>>>>>I have a form with a procedure that needs to be called from multiple places within the same form. If I place the procedure in a procedure file I can no longer make "thisform" type refrences. Where can I store this procedure so that it is considered part of the form?
>>>>>>
>>>>>>Besides of adding a method, You could send a reference to the form along with the functioncall.
>>>>>>
>>>>>>
>>>>>>Like:
>>>>>>
>>>>>>DO myfunction WITH param1, param2, THISFORM
>>>>>>
>>>>>>function MyForm
>>>>>> lparameters param1, param2, oForm
>>>>>> ....
>>>>>> Do some stuff
>>>>>> ....
>>>>>> oForm.refresh()
>>>>>> oform.property = value
>>>>>>return
>>>>>>
>>>>>>Good luck,
>>>>>>
>>>>>>Walter,
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform