Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP 8 Empty Class
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00793345
Message ID:
00793652
Vues:
35
>>Just keep in mind you can not pass parameters or get back return values with BINDEVENT. However, you can handle this with setting other properties that the bound method can then use. The method in turn, can set other properties that can be read after the method fires.
>
>Question on this.
>
>If you bindevent to a property can you change the property from this event or you fall in a endless loop?

I changed the code as follows and ran it. The method only fired the original time.
PRIVATE o, x
o = NEWOBJECT('Empty')
ADDPROPERTY(o, 'FireInit')
x = NEWOBJECT('EmptyMethods')
BINDEVENT(o, 'FireInit', x, 'FireInit')
CLEAR
o.FireInit = .t.

DEFINE CLASS EmptyMethods AS Custom

	PROCEDURE FireInit
		IF TYPE('o.FireInit') = "N"
			o.FireInit = o.FireInit + 1
		ELSE
			o.FireInit = 1
		ENDIF
		WAIT WINDOW NOWAIT 'FireInit fired - ' + TRANSFORM(o.FireInit)
	ENDPROC
	PROCEDURE Release
		RELEASE THIS
	ENDPROC

ENDDEFINE
Mark McCasland
Midlothian, TX USA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform