Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Indication if the user types anything
Message
From
28/05/2009 13:55:22
 
 
To
28/05/2009 09:47:43
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01402454
Message ID:
01402512
Views:
56
>in excel if the user changes any cell and then tries to quit the program warns the user that something has been changed.
>
>i need something similar, i have a form with about 15 text boxes and 3 inputable grids. can i flag if the user changes any text box or grid after they are first populated.

I've built this into my base classes. I've done this by adding property called lNoteChange to each of the input controls. Then in InteractiveChange and ProgrammaticChange, I raise a custom AnyChange method. My form class also has an AnyChange method.

Then, in the form Init, I call a method called BindControlEvents that binds the control's AnyChange to the form's:
* Bind events of controls to events of the form as appropriate
LPARAMETERS toControl

LOCAL oControl

FOR EACH oControl IN toControl.Objects
	IF PEMSTATUS(oControl, "lNoteChange", 5) AND oControl.lNoteChange
		BINDEVENT(oControl, "AnyChange", This, "AnyChange")
	ENDIF
	
	IF PEMSTATUS(oControl, "Objects", 5)
		This.BindControlEvents(oControl)
	ENDIF

ENDFOR
Finally, in the form's AnyChange, I can react to user input:
This.lDataChanged = .T.
This.UpdateEnabled(.t.)
Tamar
Previous
Reply
Map
View

Click here to load this message in the networking platform