MTextControlState provides the basic protocol for manipulating the text associated with a text control. Each text control adopts a text control state, which maintains the underlying text data (the text state) for the text control. When a user edits a text control, the text control calls text control state functions to access the text data. The text control state also determines whether the text control is currently enabled for input.
The system includes two concrete text control state classes for simple text controls and for text controls that generate actions:
Control state classes
Generating actions from a text control | ||
To create a text control that can generate actions, build your control using the control state class TTextActionControlState, which generates actions as instances of the class TTextControlAction. |
TTextControlAction identifies the following actions:
user enters. |
To handle text actions, you can use the handler MTextControlActionHandler. This handler can handle only text actions. Implement HandleTextControlAction to provide the behavior you want. If you also need to handle other actions, you can use MViewActionHandler. In this case, you need to cast text actions from TViewAction to TTextControlAction. |
TTextControl is a convenience class that implements a text control. TTextControl adopts a text control state at construction time to maintain the underlying text data. You can use TTextControl with both TSimpleTextControlState and TTextActionControlState. A text control can also have a label associated with it.
TTextControl derives from several classes that add functionality to the text control: