>I have been trying unsuccessfully to get a return value from a form created with createobject(""). An example of what I am trying to do: display a form and allow the user to select or enter a value from then return the value selected. This is a no brainer with a standard form but I have been trying it with a form object created from a class library and cannot figure how to get the value back to the calling program.
>
>Is there a way to designate a return variable like " DO FORM x WITH varx TO varz? I have tried passing variable by reference. I have tried modeless forms and can't seem to get control back to the calling program. If I use properties in a modal form the property is destroyed prior to returning to the calling program. I have finally sunk to creating a global variable prior to creating the form and releasing it immediately after.
>
>I know there must be a better way.
Here's what I do often when I need several properties filled in by a modal dialog. The modal form has a property that is capable of storing an object reference of the parent whether it's a custom class or another form.
DO FORM ModalForm WITH oSomeObject
In the .Init of your ModalForm
LPARAMETERS roSomeObject
THISFORM.oCaller = roSomeObject
You can now access or set any properties of the object that you passed in.
After you release this ModalForm, the properties have already been set in the caller. In order to avoid a dangling object reference, it might be a good idea in the .Destroy of the ModalForm to set oCaller = .NULL. I usually do that.
Steve
Précédent
Suivant
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