Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
My_fields is not an array
Message
De
07/12/2006 09:59:08
 
 
À
07/12/2006 08:38:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01175568
Message ID:
01175622
Vues:
8
This works for me:
oform = CREATEOBJECT('Test')
oform.show
READ EVENTS

DEFINE CLASS test AS form

	Top = 0
	Left = 0
	Height = 162
	Width = 375
	DoCreate = .T.
	Caption = "Test Form"
	Name = "Form1"


	ADD OBJECT combo1 AS combobox WITH ;
		Height = 24, ;
		Left = 96, ;
		Top = 96, ;
		Width = 252, ;
		Name = "Combo1"


	ADD OBJECT text1 AS textbox WITH ;
		Height = 23, ;
		Left = 96, ;
		ReadOnly = .T., ;
		Top = 25, ;
		Width = 144, ;
		Name = "Text1"


	ADD OBJECT label1 AS label WITH ;
		AutoSize = .F., ;
		BackStyle = 0, ;
		Caption = "Alias", ;
		Height = 17, ;
		Left = 24, ;
		Top = 29, ;
		Width = 29, ;
		Name = "Label1"


	ADD OBJECT label2 AS label WITH ;
		AutoSize = .F., ;
		BackStyle = 0, ;
		Caption = "Fields", ;
		Height = 17, ;
		Left = 24, ;
		Top = 102, ;
		Width = 36, ;
		Name = "Label2"


	ADD OBJECT text2 AS textbox WITH ;
		Height = 23, ;
		Left = 95, ;
		ReadOnly = .T., ;
		Top = 61, ;
		Width = 253, ;
		Name = "Text2"


	ADD OBJECT label3 AS label WITH ;
		AutoSize = .F., ;
		BackStyle = 0, ;
		Caption = "File", ;
		Height = 17, ;
		Left = 23, ;
		Top = 65, ;
		Width = 29, ;
		Name = "Label3"


	PROCEDURE Init
		DODEFAULT()

		this.addproperty("select_file",'')
		LOCAL lcTable
		lctable = GETFILE('DBF','Select a DBF') && Chose a dbf
		IF !EMPTY(lctable)
		   use (lctable) ALIAS mytable
		   IF !EMPTY(ALIAS()) .or. DBF() = lctable
			this.select_file = ALIAS()
			this.AddProperty('my_fields[1]',.F.)
			=AFIELDS(ThisForm.my_fields,JUSTSTEM(ThisForm.select_file))&& error at this line
			ThisForm.combo1.RowSourceType = 5
			ThisForm.combo1.RowSource = [ThisForm.my_fields]
			ThisForm.combo1.Value     = ThisForm.my_fields[1]
			ThisForm.combo1.Refresh()
			ThisForm.Combo1.Interactivechange()
			ThisForm.text1.value = JUSTSTEM(ThisForm.select_File)
			Thisform.text2.value = DBF()
		   ENDIF
		ENDIF
		RETURN .T.
	ENDPROC

	PROCEDURE Destroy
		CLEAR EVENTS
		DODEFAULT()
	ENDPROC
	
	PROCEDURE text1.Refresh
		this.disabledbackcolor = thisform.combo1.backcolor
		DODEFAULT()
	ENDPROC


	PROCEDURE text2.Refresh
		this.disabledbackcolor = thisform.combo1.backcolor
		DODEFAULT()
	ENDPROC


ENDDEFINE
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform