Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
#DEFINE idiosyncracy
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
#DEFINE idiosyncracy
Miscellaneous
Thread ID:
00559473
Message ID:
00559473
Views:
50
To All,

While fooling around with #DEFINE statements I came up with this:

* note: This is a copy of the ViewCode.prg generated from the class browser...
the form was created visually.
DEFINE CLASS bform1 AS bform
	Name = "Bform1"

	ADD OBJECT bcommandbutton1 AS bcommandbutton WITH ;
		Top = 168, ;
		Left = 228, ;
		Height = 36, ;
		Width = 84, ;
		Name = "Bcommandbutton1"

	PROCEDURE bcommandbutton1.Click
		#DEFINE dcEcho

		WAIT WINDOW dcEcho
	ENDPROC

	PROCEDURE bcommandbutton1.Init
		#DEFINE dcEcho "Test of dcEcho... define is in Init()"
	ENDPROC

ENDDEFINE
When you run the form and click the button, the wait window echos the dcEcho that was defined in the Init(). If I commented out the #DEFINE dcEcho in the Click event, it errored out (no suprise there). If I put a legitimate string after the #DEFINE dcEcho in the click event, sometimes VFP would run the string from the Init() DEFINE, other times it would run the string from the Click() DEFINE.

The VFP help says that #DEFINEs are only valid in the event/method in which they are "defined".

I'm running VFP 6.

Any ideas of what's going on?

Regards,
Thom C.
Next
Reply
Map
View

Click here to load this message in the networking platform