Occurs when the contents in the control has changed.
Event ID |
Objects |
---|---|
pbm_cbnmodified |
DropDownListBox, DropDownPictureListBox |
pbm_enmodified |
SingleLineEdit, EditMask, MultiLineEdit |
pbm_renmodified |
RichTextEdit |
None
Long. Return code choices (specify in a RETURN statement):
0 Continue processing
For plain text controls, the Modified event occurs when the user indicates being finished by pressing Enter or tabbing away from the control.
For RichText Edit controls, the value of the Modified property controls the Modified event. If the property is false, the event occurs when the first change occurs to the contents of the control. The change also causes the property to be set to true, which suppresses the Modified event. You can restart checking for changes by setting the property back to false.
Resetting the Modified property is useful when you insert a document in the control, which triggers the event and sets the property (it is reporting the change to the control’s contents). To find out when the user begins making changes to the content, set the Modified property back to false in the script that opens the document. When the user begins editing, the property will be reset to true and the event will occur again.
A Modified event can be followed by a LoseFocus event.
In this example, code in the Modified event performs validation on the text the user entered in a SingleLineEdit control sle_color. If the user did not enter RED, WHITE, or BLUE, a message box indicates what is valid input; for valid input, the color of the text changes:
string ls_color
This.BackColor = RGB(150,150,150)
ls_color = Upper(This.Text)
CHOOSE CASE ls_color
CASE "RED"
This.TextColor = RGB(255,0,0)
CASE "BLUE"
This.TextColor = RGB(0,0,255)
CASE "WHITE"
This.TextColor = RGB(255,255,255)
CASE ELSE
This.Text = ""
MessageBox("Invalid input", &
"Enter RED, WHITE, or BLUE.")
END CHOOSE
This is not a realistic example: user input of three specific choices is more suited to a list box; in a real situation, the allowed input might be more general.