Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing Params in Form Classes
Message
De
17/04/2007 04:55:37
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01216407
Message ID:
01216622
Vues:
17
>Hi Gang.
>
>I have 2 form classes.
>
>FormA class and FormB class
>
>I have FormA instantiated. It has a property called p_module to track any FormB that may be instantiated from FormA.
>
>Then, when I press a button on FormA, I instantiate FormB from FormB class....
>
>Thisform.p_module = CREATEOBJECT("FormB") ......( where Thisform is FormA ).
>
>Then I run the code right after instantiating FormB...
>
>
>IF TYPE("Thisform.p_module") = "O"
>	Thisform.p_module.show()
>ENDIF
>
>
>Now I can see FormB
>
>When FormB is up, I use it to select a value from a table and THEN I want to send it back to the calling FormA (when closing the FormB)
>
>Since these are class forms, how can I send the value from FormB back to FormA?
>
>
>Thanks!

According to your code, FormA already has a reference to FormB. So FormB do not need anything to send 'back'. FormA can access public PEM on formB. However you'd need a little adjustment in your code:

1) Call formB as a modal form so it waits for it to finish.
Thisform.p_module.show(1)

2) Do not release but just hide formB to let the code continue following show(1) line. Then formB can read whatever it wants from formB (so formB in a sense is not bound to send back a single variable - this works great when you need to collect multiple information from user. ie: startdate,enddate,customer ID etc)

The downside is callers of formB should know its objects (not a blackbox form where you send a parameter and receive a parameter back). Might be acceptable in many cases.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform