Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Referencing a form from a custom object
Message
From
08/05/2001 21:27:46
Gerry Schmitz
GHS Automation Inc.
Calgary, Alberta, Canada
 
 
To
08/05/2001 21:13:45
Michael Harris
Harris and Harris Consultants
Temple Hills, Maryland, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00505082
Message ID:
00505086
Views:
17
>I have created a custom object which converts data from a group of Foxpro 2.6 for DOS tables to a Visual Foxpro database. I have a form which has two progress bars and a command button to execute the conversion. When this form is executed, it instantiates the conversion object and assigns it to a property of the form. I want to update the progress bars in the form from the object. How can I reference the form from the object. I have used the syntax: _screen.forms().prgbarOverall...... I keep getting a error saying that "forms" is not an object. Any help is greatly appreciated.

Add a custom property (eg. oForm) to your custom object that will be used to store a reference to the Form (in the same way the Form is referencing the custom object).

You can pass a reference from the Form to the custom object via .Init as a parameter when you create the custom object, or assign it from Form prior to "running" the custom object.

eg:

THISFORM.oCustom = CREATEOBJECT( "My_Custom", THISFORM )

... and in the custom object's .Init()

PARAMETER toForm

THIS.oForm = m.toForm

*** OR ***

THISFORM.oCustom = CREATEOBJECT( "My_Custom" )
THISFORM.oCustom.oForm = THISFORM

Depending on when and where you destroy the custom object, release the reference to the Form first so you don't get into some sort of deadly embrace; eg.

<...>.oForm = .F.
Previous
Reply
Map
View

Click here to load this message in the networking platform