Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to flip-flop BackColor in boxes on forms?
Message
From
08/11/1999 15:44:17
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00287008
Message ID:
00288662
Views:
12
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
Map
View

Click here to load this message in the networking platform