Modified event
Description
Occurs when the contents in the control have changed.
Event ID
|
Event ID |
Objects |
|---|---|
|
pbm_cbnmodified |
DropDownListBox, DropDownPictureListBox |
|
pbm_enmodified |
SingleLineEdit, EditMask, MultiLineEdit |
|
pbm_inkemodified |
InkEdit |
|
pbm_renmodified |
RichTextEdit |
Parameters
None
Return Values
Long. Return code choices (specify in
a RETURN statement):
-
0 Continue
processing
Usage
For plain text controls, the Modified event occurs when the
user indicates being finished by pressing Enter or tabbing away
from the control.
For InkEdit and 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
text or 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.
Examples
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:
|
1 |
string ls_color |
|
1 |
|
1 |
This.BackColor = RGB(150,150,150) |
|
1 |
|
1 |
ls_color = Upper(This.Text) |
|
1 |
CHOOSE CASE ls_color |
|
1 |
   CASE "RED" |
|
1 |
      This.TextColor = RGB(255,0,0) |
|
1 |
   CASE "BLUE" |
|
1 |
      This.TextColor = RGB(0,0,255) |
|
1 |
   CASE "WHITE" |
|
1 |
      This.TextColor = RGB(255,255,255) |
|
1 |
   CASE ELSE |
|
1 |
      This.Text = "" |
|
1 |
      MessageBox("Invalid input", & |
|
1 |
      "Enter RED, WHITE, or BLUE.") |
|
1 |
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.