Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Variables passed by reference
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00360010
Message ID:
00360012
Vues:
11
Try using an object with a property containing your required contents. Example:

loPackage=CreateObject("custom")
loPackage.AddProperty("cName","John Q. Public")
loForm=Create("TestForm", loPackage)
?loPackage.cName

This will work as an object is passed as reference by default. I've used this extensively for multi-document systems.


>Hi all,
>
>I have a form class which is passed a local variable by reference in the init method. This variable specifies the value of a control on the form. I need to set the controlsource of the control to this reference or set the value of this variable when the form is released. Any ideas???
>
>Bare-bones example:
>
>LOCAL lcName
>lcName = "John Q. Public"
>loForm = CREATE("TestForm",@lcName)
>loForm.SHOW()
>?lcName && This has to be the value typed into the form
>
>DEFINE CLASS TestForm AS Form
> ADD OBJECT txt1 AS TextBox
>
> PROCEDURE INIT
> LPARAMETER p1
>
> ** THIS.txt1.CONTROLSOURCE = p1 && this doesn't work
> ** THIS.txt1.VALUE = p1 && sets value of control but user input does not change value of lcName
>
> ENDPROC
>
> PROCEDURE DESTROY
>
> ** lcName = THIS.txt1.VALUE && this obviously won't work - lcName needs to be local to the calling procedure
>
> ENDPROC
>
>ENDDEFINE
Nigel B Coates
NBC Software Services
Dublin, Ireland.
eMail: Nigel.Coates@NBCSoftware.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform