The user is able to enter text by means of the keyboard.
Keep the following things in mind if your application accepts text input:
It is also possible to generate simulated keyboard events.
The system keeps track of which component should receive text. This component is known as the focus. For more information about the focus, see See Focus and Active Windows .
To create a vertically scrolling text field, you need a Text component and a Scrollbar component. Set up the following:
Often, when the users enter text, you'll want to restrict their input to certain characters. For instance, if they are entering a postal code, you might want to only allow numbers and hyphens. Entry and Text components have a filter property which you may use to restrict which characters the component accepts. If the user enters an unacceptable character, the filter rejects the character and sounds an error beep.
There are standard filters which are set up for common situations--accepting only those characters used in filenames, dates, numbers, etc. You may also set up a custom filter , as described in the next section.
To allow a Text or Entry to provide a custom reaction to each character as it is entered, set the component's filter to the custom filter and intercept the _filterChar() event. You may use this event to reject unwanted characters, thus providing a sort of custom filter. You may also specify that a character other than that received be entered in the text.
Gadgets and Tables can detect text input by means of the _char() event. The Gadget/Table receives text only if it has the focus. When handling the _ char() event , not that there will be more than one event for each keypress: there is a key-down event, a key-up event, and there may be several key-repeat events.