Livecode Wiki
Advertisement

A Message sent when the content of a field has changed. If there is a message handler by the same name in the message path, then it will be executed.

Message[]

Syntax:

textChanged

Is dispatched by the field whenever a user (or simulated user) action causes the content of the field to change.

The textChanged message is sent after messages such as keyDown and pasteKey but before messages such as keyUp.

To prevent potential for infinite recursion, calls to textChanged do not nest. Once a textChanged handler is being executed for a given field, another textChanged message is not sent to it, should a subsequent one be triggered.

Message handler[]

Examples:

on textChanged             -- enable the save button when a change is made
   enable button "save"
end textChanged
on textChanged             -- resize height of field to fit text
   lock screen
              -- lock screen to delay the screen update so that there is no flicker
   put the rect of me into tRect
   put item 2 of tRect + the formattedHeight of me into item 4 of tRect
   set the rect of me to tRect
end textChanged


on textChanged 
   enable button "save"
end textChanged

Use the textChanged Message handler to perform an action when the content of a field changes.

The message is sent immediately after the input operation completes, but before a screen update is requested. The corresponding update occurs at the end of the first command in the textChanged handler. This means that you can lock the screen at the first line of the handler to delay the screen update (allowing you to modify the content of the field without any flicker).

See also: openField, closeField, focusOut, menuMode & ExitField

Advertisement