Information générale
Catégorie:
Codage, syntaxe et commandes
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.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement