Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Unloading form via toolbar
Message
 
 
À
05/09/2003 23:38:56
Alan Harris-Reid
Baseline Data Services
Devon, Royaume Uni
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00825431
Message ID:
00826704
Vues:
28
Alan,

It has something to do with the scope of 'lcRetVal' variable. If you make it a property of the form, it works properly. For example,
PROCEDURE cmdForm1.Click
Thisform.AddProperty("lcRetVal", "Unknown")
DO FORM FORM2 TO Thisform.lcRetVal
WAIT WINDOW NOWAIT "Form 2 return value = "+lcRetVal
>Sergey, thanks for the reply.
>
>I tried your code and it works fine. My situation is that the modal form which returns a value is being called from a pushbutton on another form. I've stripped it down to it's simplest form as follows.
>
Create Form1.scx with...
>	Caption = "Form 1"
>	WindowType = 1
>
>Place a button form1 with...
>  Caption = "Call form 2"
>  Name = "cmdForm1"
>	PROCEDURE cmdForm1.Click
> 		LOCAL lcRetVal
>
> 		DO FORM FORM2 TO lcRetVal
>
> 		WAIT WINDOW NOWAIT "Form 2 return value = "+lcRetVal
> 	ENDPROC
>
>Create Form2.scx with...
> 	Caption = "Form 2"
>	WindowType = 1
>
>	PROCEDURE Unload
>		RETURN "The expected return value"
>	ENDPROC
>
>	PROCEDURE Init
>		thisform.top = 30     && so as not to cover form1
>		thisform.left = 30
>	ENDPROC
>
>Place a button on form2 with...
>   Name = "cmdForm2"
>	Caption = "Close Form 2"
>	
>	PROCEDURE cmdForm2.Click
>		THISFORM.RELEASE
>	ENDPROC
>Then run the toolbar sample code you sent me, but with 'DO FORM Form1' instead of 'DO FORM MyForm TO RetVal'. Press the button on form1 to call form2. Pressing the button on form2 closes the form and correctly displays the return value in the WAIT WINDOW, but closing form2 using the toolbar (either button) produces an error ('Operator type mismatch...') that suggests the value was not returned to the variable.
>
>I appreciated it's not a simple problem, but if anyone can throw any light on this problem, I would be grateful.
>
>Regards,
>Alan
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform