A text-field% object is an editable text field with an optional label displayed in front of it. There are two text field styles:
Whenever the user changes the content of a text field, its callback procedure is invoked. A callback procedure is provided as an initialization argument when each text field is created.
The text field is implemented using a text% editor (with an inaccessible display). Thus, whereas text-field% provides only get-value and set-value to manipulate the text in a text field, the get-editor returns the field's editor, which provides a vast collection of methods for more sophisticated operations on the text.
The keymap for the text field's editor is initialized by calling the current keymap initializer procedure, which is determined by the current-text-keymap-initializer parameter.
If label is not #f, it is used as the text field label. Otherwise, the text field will does not display its label.
If an ampersand (``&'') occurs in label, it is specially parsed; under Windows and X, the character following an ampersand is underlined in the displayed control to indicate a keyboard mnemonic. (Under MacOS, mnemonic underlines are not shown.) The underlined mnemonic character must be a letter or a digit. The user can move the keyboard focus to the text field by typing the mnemonic when the control's top-level-window contains the keyboard focus. The user must also hold down the Meta or Alt key if the keyboard focus is currently in a control that handles normal alphanumeric input. The ampersand itself is removed from label before it is displayed for the control; a double-ampersand in label is converted to a single ampersand (with no mnemonic underlining). Mnemonic keyboard events are handled by on-traverse-char (but not under MacOS).
The callback procedure is called when the user changes the text in the text field or presses the Enter key (and Enter is not handled by the text field's frame or dialog; see on-traverse-char in top-level-window<%> ). If the user presses Enter, the type of event passed to the callback is 'text-field-enter, otherwise it is 'text-field.
If init-value is not "", the minimum width of the text item is made wide enough to show init-value. Otherwise, a built-in default width is selected. For a text field in single-line mode, the minimum height is set to show one line and only the control's width is stretchable. For a multiple-line text field, the minimum height shows three lines of text and is stretchable in both directions.
The style must contain exactly one of 'single or 'multiple; the former specifies a single-line field and the latter specifies a multiple-line field. The 'hscroll style applies only to multiple-line fields; when 'hscroll is specified, the field has a horizontal scrollbar and autowrapping is disabled; otherwise, the field has no horizontal scrollbar and autowrapping is enabled. A multile-line text field always has a vertical scrollbar.