Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return values through parameter references
Message
De
11/08/2008 16:00:26
 
 
À
11/08/2008 08:52:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Vista
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01337702
Message ID:
01338151
Vues:
12
>>Interesting point. I generally assume that any form that is expected to return or set a value probably "should" be modal, because if it is not, you gotta do a lot of hand-waving and peeking and poking to see what has been happening in the "secondary" form. In that case, I suppose one might as well turn on some actual event handling for a cleaner process.
>
>If you want a modeless form to return a value, then the passing of an object with properties to hold the values works very well. But the object has to exist globally at the calling program to the modeless form. In this case setup an event and bind a UDF to it. Then in the modeless form, raise the event when returning. You also need to take care to remove the modeless form if the calling form/procedure ends (nothing to return to...).

Global object? What travesty! (Or at least that's what a purist OOP architect would say)

If you pass an object as a paramater (by reference, which in procedure calls is the default, anyways), why do need to worry about making it global? As long as the receiving form gets the object reference, it has full access to it, and any changes made to it in the called form are reflected in the object in the calling form.

For example:

1. Call a form from another form with the calling form's call button as a parameter:
Button click:
DO FORM AnotherForm WITH This
2. Called form receives and can manipulate the calling button (and any other objects in the calling form at least within the INIT -method):
Form Init:
LPARAM toCallingButton
toCallingButton.Visible = .F.
toCallingButton.Parent.Visible = .F.
Pertti Karjalainen
Product Manager
Northern Lights Software
Fairfax, CA USA
www.northernlightssoftware.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform