Class Fox::FXTextField

In: | FXTextField.rb
Parent: | FXFrame

A text field is a single-line text entry widget. The text field widget supports clipboard for cut-and-paste operations.

### Events

The following messages are sent from FXTextField to its target:

`SEL_COMMAND`: | sent when the user presses the Enter key or tabs out of the text field; the message data is a String containing the text.
`SEL_CHANGED`: | sent when the text changes; the message data is a String containing the text.
`SEL_VERIFY`: | sent when the user attempts to enter new text in the text field; the message data is a String containing the proposed new text.
`SEL_KEYPRESS`: | sent when a key goes down; the message data is an FXEvent instance.
`SEL_KEYRELEASE`: | sent when a key goes up; the message data is an FXEvent instance.
`SEL_LEFTBUTTONPRESS`: | sent when the left mouse button goes down; the message data is an FXEvent instance.
`SEL_LEFTBUTTONRELEASE`: | sent when the left mouse button goes up; the message data is an FXEvent instance.
`SEL_MIDDLEBUTTONPRESS`: | sent when the middle mouse button goes down; the message data is an FXEvent instance.
`SEL_MIDDLEBUTTONRELEASE`: | sent when the middle mouse button goes up; the message data is an FXEvent instance.

### Textfield styles

`TEXTFIELD_PASSWD`: | Password mode
`TEXTFIELD_INTEGER`: | Integer mode
`TEXTFIELD_REAL`: | Real mode
`TEXTFIELD_READONLY`: | NOT editable
`TEXTFIELD_ENTER_ONLY`: | Only callback when enter hit
`TEXTFIELD_LIMITED`: | Limit entry to given number of columns
`TEXTFIELD_OVERSTRIKE`: | Overstrike mode
`TEXTFIELD_NORMAL`: | `FRAME_SUNKEN|FRAME_THICK`

### Message identifiers

`ID_CURSOR_HOME`:: `ID_CURSOR_END`:: `ID_CURSOR_RIGHT`:: `ID_CURSOR_LEFT`:: `ID_MARK`:: `ID_EXTEND`:: `ID_SELECT_ALL`:: `ID_DESELECT_ALL`:: `ID_CUT_SEL`:: `ID_COPY_SEL`:: `ID_PASTE_SEL`:: `ID_DELETE_SEL`:: `ID_OVERST_STRING`:: `ID_INSERT_STRING`:: `ID_BACKSPACE`:: `ID_DELETE`:: `ID_TOGGLE_EDITABLE`:: `ID_TOGGLE_OVERSTRIKE`:: `ID_BLINK`::

Methods

editable? extendSelection killSelection makePositionVisible new posSelected? posVisible? selectAll setSelection

Attributes

anchorPos | [RW] | Anchor position [Integer]
cursorPos | [RW] | Cursor position [Integer]
editable | [W] | Text field editability [Boolean]
font | [RW] | Text font [FXFont]
helpText | [RW] | Status line help text [String]
justify | [RW] | Text justification mode [Integer]
numColumns | [RW] | Width of this text field, in terms of number of columns * ‘m’ [Integer]
selBackColor | [RW] | Background color for selected text [FXColor]
selTextColor | [RW] | Foreground color for selected text [FXColor]
text | [RW] | Text [String]
textColor | [RW] | Text color [FXColor]
textStyle | [RW] | Text style [Integer]
tipText | [RW] | Tool tip message [String]

Public Class methods

new(p, numColumns, tgt=nil, sel=0, opts=TEXTFIELD_NORMAL, x=0, y=0, w=0, h=0, pl=DEFAULT_PAD, pr=DEFAULT_PAD, pt=DEFAULT_PAD, pb=DEFAULT_PAD) {|theTextField| ...}

Construct text field wide enough to display numColumns columns

Public Instance methods

editable?()

Return `true` if text field may be edited

selectAll()

Select all text

setSelection(pos, len)

Select len characters starting at given position pos.

extendSelection(pos)

Extend the selection from the anchor to the given position pos.

killSelection()

Unselect the text

posSelected?(pos)

Return `true` if position pos is selected.

posVisible?(pos)

Return `true` if position pos is fully visible.

makePositionVisible(pos)

Scroll text to make the given position pos visible.