Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to return a value from a non-visual form?
Message
De
13/07/2001 09:45:00
 
 
À
13/07/2001 04:39:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00530047
Message ID:
00530212
Vues:
30
>>How can I get the return value of a form created programatically?
>
>Well, I think the correct theoretical answer would be that you don't treat a class (any class) as if it were a function at all. Something a bit more OOP-like which would solve your problem would probably read like this:
>
>
>LOCAL loForm, lcReturnValue
>
>loForm = CREATEOBJECT("frmModal")
>loForm.Show()
>lcReturnValue = loForm.cReturnValue && "Hello World" is now in lcReturnValue
>loForm.Release()
>
>
>
>DEFINE CLASS frmModal AS Form
>     WindowType = 1
>     cReturnValue = ""
>
>     PROCEDURE CloseForm    && This would be called by an OK button
>          WITH Thisform
>               .cReturnValue = "Hello World"
>               .Hide()
>          ENDWITH
>     ENDPROC
>ENDDEFINE
>
>
>Note that Hide() releases a modal state the same way Release() does. Also, I invariably invoke forms using CREATEOBJECT(), rather than DO FORM.
>
>If you're playing around with this code, please bear with the fact that I'm writing at about 3:30am Central Daylight, and my exact syntax may be a bit fuzzy. :)

Hallelujah! It works like charm. This help me tremendously! Can I give you five stars instead?

A follow-up question but does not really requires an answer as I may soon find this out. Will converting my visual class/forms to text-based format have a significant impact on the total size my EXE?
ramil
~~ learning to stand still
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform