Information générale
Catégorie:
Gestionnaire d'écran & Écrans
>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.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement