I tested a new a simple object using the assign method. What I wanted was to have the background colour of the textbox change if the value was changed from the original value. I created a subclassed textbox and added a startingvalue property to use as a reference.
Here is the code for Value_assign method of the textbox subclass:
LPARAMETER vNewval
IF ALLTRIM(vNewval) <> ALLTRIM(this.startvalue)
this.backcolor = RGB(227, 0, 0)
ENDIF
THIS.Value = m.vNewVal
Really simple. When I assigned the initial value in the init of a form that had this textbox (first by setting the startvalue and then the textbox value so they would be the same, the assign method fired. However, it only fires if the change to the value occurs within code. If I change the value in the textbox field then the assign method does not fire. What I did to get the behaviour I wanted was add
this.value_assign(this.value) into the valid clause of the textbox so default valid behaviour is to call the assign method.
Is this the behaviour to expect? That is, the assign method only fires when a textbox receives a new value from code and not during data entry?
Suivant
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