Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can you run a CLIICKED event from a procedure file?
Message
From
05/12/1997 13:41:19
 
 
To
05/12/1997 13:38:05
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00064061
Message ID:
00064076
Views:
34
>>>Robert,
>>>
>>>I assume you are calling the form with a DO FORM command in main.prg. The easiest way to do what you want to do is to use the NAME clause of DO FORM. Try this:
>>>
>>>DO FORM MyForm NAME loMyForm
>>>
>>>VFP will create a memory variable called loMyForm that contains a reference to your form. Now you can do this:
>>>
>>>loMyForm.cmd_ok.Click
>>>
>>>Keep in mind that if the variable goes out of scope, you won't be able to use it. You can resolve this by passing loMyForm as a parameter to any other procedure that may need it.
>>>
>>>>I have a main.prg and I want to fire off
>>>> myform.cmd_ok_click. How can I do this?
>>
>>Hi Josh..
>>I am not going to be calling any FORM. I just wanted to run the myform.click()
>>from my main.prg. Is there a way?
>>:)))
>
>You can't run code in a form that isn't alive. You can however, DO FORM blahform NAME loBLAHFORM LINKED NOSHOW
>which will run the form but keep it hidden. YOu can then reference objects on that form and call their methods.

On second thought, if you have code in a form that needs to be run when the form is not open, then maybe the code doesn't belong in that form anyway. You would be better off writing a procedure or an application method, and calling that method from the button and wherever else ou want to run it from.
Erik Moore
Clientelligence
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform