General information
Category:
Coding, syntax & commands
Steve, I have a little different way to do what you are trying to do.
If you are using VFP6, this is pretty simple, but it still can be done if VFP5.
SubClass the control into a VCX. Add a property to the control called 'is_valid' or what every you want. As you add the property, click the assign check box, this will create a method to go with your new property called 'is_valid_assign'. In the is_valid_assign method, I put the following code:
LPARAMETERS vNewVal
*To do: Modify this routine for the Assign method
THIS.is_valid = m.vNewVal
IF vNewVal = .T.
THIS.BackColor = RGB(255,255,255)
ELSE
THIS.BackColor = RGB(255,200,200)
ENDIF
Now, when you change the value of THIS.is_valid to true or false, the is_valid_assign method if fired off.
So in your InteractiveChange and ProgrammaticChange methods, you just validate THIS.Value and save true or false to THIS.is_valid. The changing of the background is automatic and no THIS.Refresh() was called.
One side benefit of doing the background color this way is that when I need to save a new record or something, each control then does it's own validations and I just check each control's 'is_valid' property to see if the data in the control is valid.
Rob.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only