Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Variables passed by reference
Message
De
15/04/2000 21:22:59
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00360010
Message ID:
00360067
Vues:
9
>Thanks for all the input! Implementing what has been suggested (and formatting a bit), I have:
>
...snip code...

>This doesn't work. The value of the textbox is "John Q. Public" when the form is SHOWn, but user input does not change the value of lcName.

What the others have been trying to get you to use is an object instead of a character memvar. The following code does what I *think* you are trying for.
LOCAL loName, loForm

loName = CREATEOBJECT( 'Variable', "John Q. Public" )
loForm = CREATEOBJECT("TestForm",loName)
loForm.SHOW(1)

ACTIVATE SCREEN

?loName.value  && This has to be the value typed into the form

DEFINE CLASS Variable AS CUSTOM
	value = ''
	
	PROCEDURE Init
	LPARAMETER tcValue
	this.value = tcValue
	ENDPROC
	
ENDDEFINE

DEFINE CLASS TestForm AS Form
  AUTOCENTER = .T.
  WIDTH = 150
  HEIGHT = 74
  Test = ""
  
  ADD OBJECT txt1 AS TEXTBOX WITH ;
    HEIGHT = 22, ;
    LEFT = 10, ;
    TOP = 10, ;
    WIDTH = 130
    
  ADD OBJECT cmd1 AS COMMANDBUTTON WITH ;
    CAPTION = "Exit", ;
    HEIGHT = 22, ;
    LEFT = 45, ;
    TOP = 40, ;
    TERMINATEREAD = .T., ;
    WIDTH = 60

  PROCEDURE INIT
  LPARAMETER p1

  this.test = p1
  THIS.txt1.CONTROLSOURCE = "THISFORM.Test.value"

  ENDPROC

ENDDEFINE
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform