Class: Fox::FXTextField

Inherits:
FXFrame show all
Defined in:
rdoc-sources/FXTextField.rb

Overview

A text field is a single-line text entry widget. The text field widget supports clipboard for cut-and-paste operations. The text field also sends SEL_COMMAND when the focus moves to another control. TEXTFIELD_ENTER_ONLY can be passed to suppress this feature. Typically, this flag is used in dialogs that close when ENTER is hit in a text field.

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

Instance Attribute Summary collapse

Attributes inherited from FXFrame

#baseColor, #borderColor, #borderWidth, #frameStyle, #hiliteColor, #padBottom, #padLeft, #padRight, #padTop, #shadowColor

Attributes inherited from FXWindow

#accelTable, #backColor, #defaultCursor, #dragCursor, #first, #focus, #key, #last, #layoutHints, #next, #numChildren, #owner, #parent, #prev, #root, #selector, #shell, #target, #x, #y

Attributes inherited from FXDrawable

#height, #visual, #width

Attributes inherited from FXId

#app, #userData, #xid

Instance Method Summary collapse

Methods inherited from FXWindow

#acceptDrop, #acquireClipboard, #acquireSelection, #active?, #addHotKey, #after?, after?, #before?, before?, #beginDrag, #canFocus?, #changeFocus, #childAtIndex, #childOf?, #children, #clearDragRectangle, #clearShape, colorType, colorTypeName, commonAncestor, #composeContext, #composite?, #contains?, #containsChild?, #create, #createComposeContext, #cursorPosition, #default?, #defaultHeight, #defaultWidth, deleteType, deleteTypeName, #destroy, #destroyComposeContext, #detach, #didAccept, #disable, #doesSaveUnder?, #dragging?, #dropDisable, #dropEnable, #dropEnabled?, #dropFinished, #dropTarget?, #each_child, #each_child_recursive, #enable, #enabled?, #endDrag, #forceRefresh, #getChildAt, #getDNDData, #getHeightForWidth, #getWidthForHeight, #grab, #grabKeyboard, #grabbed?, #grabbedKeyboard?, #handleDrag, #hasClipboard?, #hasFocus?, #hasSelection?, #height, #height=, #hide, imageType, #inFocusChain?, #indexOfChild, #initial?, #inquireDNDAction, #inquireDNDTypes, #killFocus, #layout, #linkAfter, #linkBefore, #lower, #move, octetType, octetTypeName, #offeredDNDType?, #position, #raiseWindow, #recalc, #releaseClipboard, #releaseSelection, #remHotKey, #removeChild, #repaint, #reparent, #resize, #scroll, #setCursorPosition, #setDNDData, #setDefault, #setDragRectangle, #setFocus, #setInitial, #setShape, #shell?, #show, #shown?, stringType, textType, textTypeName, #tr, #translateCoordinatesFrom, #translateCoordinatesTo, #underCursor?, #ungrab, #ungrabKeyboard, #update, urilistType, urilistTypeName, utf16Type, utf16TypeName, utf8Type, utf8TypeName, #visible=, #width, #width=

Methods included from Responder2

#connect

Methods inherited from FXDrawable

#resize

Methods inherited from FXId

#create, #created?, #destroy, #detach, #runOnUiThread

Methods inherited from FXObject

#bind, #handle, #load, #save, subclasses

Constructor Details

#initialize(p, ncols, target = nil, selector = 0, opts = TEXTFIELD_NORMAL, x = 0, y = 0, width = 0, height = 0, padLeft = DEFAULT_PAD, padRight = DEFAULT_PAD, padTop = DEFAULT_PAD, padBottom = DEFAULT_PAD) ⇒ FXTextField

Return an initialized FXTextField instance. It should be wide enough to display ncols columns.

Parameters:

p

the parent window for this text field Fox::FXComposite

ncols

number of visible items [Integer]

target

the message target, if any, for this text field Fox::FXObject

selector

the message identifier for this text field [Integer]

opts

text field options [Integer]

x

initial x-position [Integer]

y

initial y-position [Integer]

width

initial width [Integer]

height

initial height [Integer]

padLeft

internal padding on the left side, in pixels [Integer]

padRight

internal padding on the right side, in pixels [Integer]

padTop

internal padding on the top side, in pixels [Integer]

padBottom

internal padding on the bottom side, in pixels [Integer]



118
119
# File 'rdoc-sources/FXTextField.rb', line 118

def initialize(p, ncols, target=nil, selector=0, opts=TEXTFIELD_NORMAL, x=0, y=0, width=0, height=0, padLeft=DEFAULT_PAD, padRight=DEFAULT_PAD, padTop=DEFAULT_PAD, padBottom=DEFAULT_PAD) # :yields: theTextField
end

Instance Attribute Details

#anchorPosObject

Anchor position [Integer]



66
67
68
# File 'rdoc-sources/FXTextField.rb', line 66

def anchorPos
  @anchorPos
end

#cursorPosObject

Cursor position [Integer]



63
64
65
# File 'rdoc-sources/FXTextField.rb', line 63

def cursorPos
  @cursorPos
end

#editable=(value) ⇒ Object (writeonly)

Text field editability [Boolean]



60
61
62
# File 'rdoc-sources/FXTextField.rb', line 60

def editable=(value)
  @editable = value
end

#fontObject

Text font Fox::FXFont



72
73
74
# File 'rdoc-sources/FXTextField.rb', line 72

def font
  @font
end

#helpTextObject

Status line help text [String]



90
91
92
# File 'rdoc-sources/FXTextField.rb', line 90

def helpText
  @helpText
end

#justifyObject

Text justification mode, a combination of horizontal justification (JUSTIFY_LEFT, JUSTIFY_RIGHT, or JUSTIFY_CENTER_X), and vertical justification (JUSTIFY_TOP, JUSTIFY_BOTTOM, JUSTIFY_CENTER_Y) [Integer]



87
88
89
# File 'rdoc-sources/FXTextField.rb', line 87

def justify
  @justify
end

#numColumnsObject

Default width of this text field, in terms of a number of columns times the width of the numeral ‘8’ [Integer]



84
85
86
# File 'rdoc-sources/FXTextField.rb', line 84

def numColumns
  @numColumns
end

#selBackColorObject

Background color for selected text Fox::FXColor



78
79
80
# File 'rdoc-sources/FXTextField.rb', line 78

def selBackColor
  @selBackColor
end

#selTextColorObject

Foreground color for selected text Fox::FXColor



81
82
83
# File 'rdoc-sources/FXTextField.rb', line 81

def selTextColor
  @selTextColor
end

#textObject

Text [String]



69
70
71
# File 'rdoc-sources/FXTextField.rb', line 69

def text
  @text
end

#textColorObject

Text color Fox::FXColor



75
76
77
# File 'rdoc-sources/FXTextField.rb', line 75

def textColor
  @textColor
end

#textStyleObject

Text style [Integer]



96
97
98
# File 'rdoc-sources/FXTextField.rb', line 96

def textStyle
  @textStyle
end

#tipTextObject

Tool tip message [String]



93
94
95
# File 'rdoc-sources/FXTextField.rb', line 93

def tipText
  @tipText
end

Instance Method Details

#editable?Boolean

Return true if text field may be edited

Returns:

  • (Boolean)


122
# File 'rdoc-sources/FXTextField.rb', line 122

def editable?() ; end

#extendSelection(pos) ⇒ Object

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



137
# File 'rdoc-sources/FXTextField.rb', line 137

def extendSelection(pos) ; end

#killSelectionObject

Unselect the text



140
# File 'rdoc-sources/FXTextField.rb', line 140

def killSelection() ; end

#makePositionVisible(pos) ⇒ Object

Scroll text to make the given position pos visible.



149
# File 'rdoc-sources/FXTextField.rb', line 149

def makePositionVisible(pos) ; end

#overstrike=(os) ⇒ Object

Set overstrike mode to true or false.



125
# File 'rdoc-sources/FXTextField.rb', line 125

def overstrike=(os); end

#overstrike?Boolean

Return true if overstrike mode is set.

Returns:

  • (Boolean)


128
# File 'rdoc-sources/FXTextField.rb', line 128

def overstrike?; end

#posSelected?(pos) ⇒ Boolean

Return true if position pos is selected.

Returns:

  • (Boolean)


143
# File 'rdoc-sources/FXTextField.rb', line 143

def posSelected?(pos) ; end

#posVisible?(pos) ⇒ Boolean

Return true if position pos is fully visible.

Returns:

  • (Boolean)


146
# File 'rdoc-sources/FXTextField.rb', line 146

def posVisible?(pos) ; end

#selectAllObject

Select all text



131
# File 'rdoc-sources/FXTextField.rb', line 131

def selectAll(); end

#setSelection(pos, len) ⇒ Object

Select len characters starting at given position pos.



134
# File 'rdoc-sources/FXTextField.rb', line 134

def setSelection(pos, len) ; end