Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling Modal Child Dialog
Message
De
27/05/2002 19:23:02
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
CodeMine
Divers
Thread ID:
00657702
Message ID:
00661808
Vues:
32
Hi Mel:

>In the modal form, I have iReleaseOnClose = .T., and uValue to .T. I have also tried and set uValue = TxtOrdNo also, and still no success.

You need to set uValue to the the value of TxtOrdNo at runtime, not the literal string "TxtOrdNo" at design time. In the modal form's saveallchanges() method (called automatically after OK has been selected), set the value of uValue to the value contained in TxtOrdNo. I haven't tested the following code so you may need to work with it :-
filtord.SaveAllChanges
if dodefault(cWorkareaList)
   * If we get a "True" return value from calling dodefault()
   * we are sure that OK was pressed. However, this call
   * will set THIS.uValue to boolean True. Overide the value
   * at this point.
   this.uValue = this.TxtOrdNo.Value
   return .t.
endif
Its probably worth pointing out that if you save your modal form as a class (and not an SCX), you could use a native createobject() and call its show method. Then after the OK button has been selected, the form hides itself but you can interogate the form's properties via the object reference to the form. You can then call the form's release method after you have done with it.

>And one final question about this. Is:
>
>
> Do Form Whatever to cUser1
>
>
>just as good to way to open a Modal form with a CodeMine command button found on a form, or shoud I be using something like:
>
>
> m.goStateManager.OpenModalForm('filtord.scx')
>
Well, the answer as always is, "it depends". If you use the statemanager.openmodalform(), then the framework knows you have opened the form and can manage it. However, say you are opening a modal data child form - it needs to inherit its parent's data session so statemanager.openmodalform() would not be the way to go in this circumstance (using a native createobject would be right in these circumstances as the child form would still have access to its parents datasession).

Using DO FORM is OK for quick and dirty forms, but, as you have seen, it is more difficult to query values in the form after the form has closed. The thing about the uValue property is that it is just a single property to contain a single return value and it is usually set according to the value of the form's lChanged property (if something has changed you get True, if not False). So, this is OK where you just want to return a simple value, generally True/False. But, where you want to do anything more than this, then you are probably better off being able to interogate the modal form's properties from the calling process after the modal form has been hidden and then when you are done, call its (the modal child form) release method.

As a general rule, you could say that using the statemanager to open a form is really used from a menu or toolbar - a kind of primary form call. However, when you are in a form, then you are probably better using createobject or do form.

HTH
-=Gary
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform