Information générale
Catégorie:
Codage, syntaxe et commandes
>>>How would I convert "DO FORM xxx WITH yyy TO zzz" To "ofrm = CREATEOBJECT()"
>>>
>>>How do I return a value from an object when the object is created with "CREATEOBJECT()". Thanks.
>>
>>Just to add to what Ryan said. Be sure you check to make sure that the user didn't close the form using the Close button in the upper right hand corner. If they did, the variable will still evaluate to an object, but it will be null, and you won't have access to any of the properties.
>
>
>Good point. I was wondering if I was missing something. Here's a question, then. If the goal is to use a modal form and allow the user to choose some parameters and then pass them back to the calling routine upon closing, does CREATEOBJECT not handle this gracefully? In other words, would DO FORM be more appropriate, or can any return values from a form be read from a calling routine? If the return values can be read from the calling routine, how would this be done? Createobject seems great when you have one routine that starts and shuts down the object programmatically, but what would you do for the 'mixed' scenario you describe in which a routine starts an object, but something on the object itself closes it?
This is what I did to get CREATEOBJECT to return a value from a modal form
oprntprev = CREATEOBJECT('Print_Preview',tnDest)
oprntprev.show(1)
lnPrint = oprntprev.ReturnValr
Instead of Releasing the modal form, I issue a Thisform.Hide when the user exits. Control returns from the modal form, but I still have access to the objects properties(ReturnVal). There is probably a better way to do this, but this did work for me.
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