Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I call a Method from outside the Form
Message
From
13/03/2005 22:22:57
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
13/03/2005 22:00:39
Freddie Rodrigues
Bitrun Business Solutions
Mumbai, India
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00995365
Message ID:
00995367
Views:
20
>The Form name is uditempl. From within the Form I have no problems. I need to call this Method, from either a Class or a program file if possible.
>
>Thisform.pageframe1.page1.itemsgrid.setfocus()
>
>Thanks

First, you need to have an object reference to the form. This is best done when you instantiate (open) the form. For example, if your form is saved as a class:
local loForm
loForm = CreateObject("cClient")
Or, if the form is saved as a form:
local loForm
do form FrmClient name loForm
Now, from outside the form, you can use loForm (or whatever you call it - it is your variable) just as you would use ThisForm from within the form. For instance, your example becomes:
loForm.pageframe1.page1.itemsgrid.setfocus()
or you can call a form method:
loForm.RecalculateTotals() && assuming you created this method
Saludos,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform