XmTextField (3) - Linux Manuals
XmTextField: The TextField class
NAME
XmTextField --- The TextField classSYNOPSIS
#include <Xm/Xm.h>
DESCRIPTION
The TextField widget provides a single line text editor for customizing both user and programmatic interfaces. It is used for single-line string entry, and forms entry with verification procedures. It provides an application with a consistent editing system for textual data.
TextField provides separate callback lists to verify movement of the insert cursor, modification of the text, and changes in input focus. Each of these callbacks provides the verification function with the widget instance, the event that caused the callback, and a data structure specific to the verification type. From this information, the function can verify if the application considers this to be a legitimate state change and can signal the widget whether to continue with the action.
The user interface tailors a new set of actions. The key bindings have been added for insert cursor movement, deletion, insertion, and selection of text.
TextField allows the user to select regions of text. Selection is based on the model specified in the Inter-Client Communication Conventions Manual (ICCCM). TextField supports primary and secondary selection.
TextField uses the XmQTnavigator, XmQTspecifyRenderTable, and XmQTscrollFrame traits, and holds the XmQTaccessTextual XmQTtransfer traits.
If an application or widget calls the setValue trait method of XmQTaccessTextual, then XmTextField will call XmTextFieldSetString to set the string value.
Data Transfer Behavior
TextField supports transfer of the primary, secondary, and clipboard selections and dragging of selected text from the widget. TextField can also be the destination for the primary, secondary, and clipboard selections, and it supports dropping of data being dragged onto the widget.
When the XmNconvertCallback procedures are called, the location_data member of the XmConvertCallbackStruct member is NULL if the selected text is being transferred. If the entire text, not the selected text, is being transferred, the value of this member is the widget ID of the TextField widget.
As a source of data, TextField supports the following targets and associated conversions of data to these targets:
- UTF8_STRING
- The widget transfers the selected text as type UTF8_STRING.
- locale
- If the locale target matches the widget's locale, the widget transfers the selected text in the encoding of the locale.
- COMPOUND_TEXT
- The widget transfers the selected text as type COMPOUND_TEXT.
- STRING
- The widget transfers the selected text as type STRING.
- TEXT
- If the selected text is fully convertible to the encoding of the locale, the widget transfers the selected text in the encoding of the locale. Otherwise, the widget transfers the selected text as type COMPOUND_TEXT.
- DELETE
- The widget deletes the selected text.
- _MOTIF_CLIPBOARD_TARGETS
-
The widget transfers, as type ATOM, a list of the targets to which
the widget can convert data to be placed on the clipboard immediately.
These include the following targets:
-
- •
- UTF8_STRING
- •
- COMPOUND_TEXT
- •
- The encoding of the locale, if the selected text is fully convertible to the encoding of the locale
- •
- STRING, if the selected text is fully convertible to STRING
-
- _MOTIF_EXPORT_TARGETS
- The widget transfers, as type ATOM, a list of the targets to be used as the value of the DragContext's XmNexportTargets in a drag-and-drop transfer. These include COMPOUND_TEXT, the encoding of the locale, STRING, TEXT, UTF8_STRING, BACKGROUND, and FOREGROUND.
- _MOTIF_LOSE_SELECTION
-
The widget takes the following actions:
-
- •
- When losing the PRIMARY selection, it unhighlights the selected text and calls the XmNlosePrimaryCallback procedures.
- •
- When losing the SECONDARY selection, it removes the secondary selection highlight.
- •
- When losing the _MOTIF_DESTINATION selection, if the widget does not have focus it changes the cursor to indicate that the widget is no longer the destination.
-
As a source of data, TextField also supports the following standard Motif targets:
- BACKGROUND
- The widget transfers XmNbackground as type PIXEL.
- CLASS
- The widget finds the first shell in the widget hierarchy that has a WM_CLASS property and transfers the contents as text in the current locale.
- CLIENT_WINDOW
- The widget finds the first shell in the widget hierarchy and transfers its window as type WINDOW.
- COLORMAP
- The widget transfers XmNcolormap as type COLORMAP.
- FOREGROUND
- The widget transfers XmNforeground as type PIXEL.
- NAME
- The widget finds the first shell in the widget hierarchy that has a WM_NAME property and transfers the contents as text in the current locale.
- TARGETS
- The widget transfers, as type ATOM, a list of the targets it supports. These include the standard targets in this list. These also include COMPOUND_TEXT, the encoding of the locale, STRING, TEXT and UTF8_STRING.
- TIMESTAMP
- The widget transfers the timestamp used to acquire the selection as type INTEGER.
- _MOTIF_RENDER_TABLE
- The widget transfers XmNrenderTable if it exists, or else the default text render table, as type STRING.
- _MOTIF_ENCODING_REGISTRY
- The widget transfers its encoding registry as type STRING. The value is a list of NULL separated items in the form of tag encoding pairs. This target symbolizes the transfer target for the Motif Segment Encoding Registry. Widgets and applications can use this Registry to register text encoding formats for specified render table tags. Applications access this Registry by calling XmRegisterSegmentEncoding and XmMapSegmentEncoding.
As a destination for data, TextField chooses a target and requests conversion of the selection to that target. If the encoding of the locale is present in the list of available targets, TextField chooses a requested target from the available targets in the following order of preference:
- 1.
- TEXT
- 1.
- UTF8_STRING
- 2.
- COMPOUND_TEXT
- 3.
- The encoding of the locale
- 4.
- STRING
If the encoding of the locale is not present in the list of available targets, TextField chooses a requested target from the available targets in the following order of preference:
- 1.
- UTF8_STRING
- 1.
- COMPOUND_TEXT
- 2.
- STRING
Classes
TextField widget inherits behavior, resources, and traits from Core and Primitive.
The class pointer is xmTextFieldWidgetClass.
The class name is XmTextField.
New Resources
The following table defines a set of widget resources used by the programmer to specify data. The programmer can also set the resource values for the inherited classes to set attributes for this widget. To reference a resource by name or by class in a .Xdefaults file, remove the XmN or XmC prefix and use the remaining letters. To specify one of the defined values for a resource in a .Xdefaults file, remove the Xm prefix and use the remaining letters (in either lower case or upper case, but include any underscores between words). The codes in the access column indicate if the given resource can be set at creation time (C), set by using XtSetValues (S), retrieved by using XtGetValues (G), or is not applicable (N/A).
|
1 This resource cannot be specified in a resource file.
- XmNactivateCallback
- Specifies the list of callbacks that is called when the user invokes an event that calls the activate() action. The type of the structure whose address is passed to this callback is XmAnyCallbackStruct. The reason sent by the callback is XmCR_ACTIVATE.
- XmNblinkRate
- Specifies the blink rate of the text cursor in milliseconds. The time indicated in the blink rate relates to the length of time the cursor is visible and the time the cursor is invisible (that is, the time it will take to blink the insertion cursor on and off will be two times the blink rate). The cursor will not blink when the blink rate is set to 0 (zero). The value must not be negative.
- XmNcolumns
- Specifies the initial width of the text window as an integer number of characters. The width equals the number of characters specified by this resource multiplied by the width as derived from the specified font. If the em-space value is available, it is used. If not, the width of the numeral "0" is used. If this is not available, the maximum width is used. For proportionate fonts, the actual number of characters that fit on a given line may be greater than the value specified.
- XmNcursorPosition
- Indicates the position in the text where the current insert cursor is to be located. Position is determined by the number of characters from the beginning of the text.
- XmNcursorPositionVisible
- If the text widget has an XmPrintShell as one of its ancestors (that is, the widget was created on a print server connection) then the default value is False; otherwise, it is True.
- XmNdestinationCallback
- Specifies a list of callbacks called when the widget is the destination of a transfer operation. The type of the structure whose address is passed to these callbacks is XmDestinationCallbackStruct. The reason is XmCR_OK.
- XmNeditable
- When set to True, indicates that the user can edit the text string. A false value will prohibit the user from editing the text.
- When XmNeditable is used on a widget it sets the dropsite to XmDROP_SITE_ACTIVE.
- XmNfocusCallback
- Specifies the list of callbacks called when TextField accepts input focus. The type of the structure whose address is passed to this callback is XmAnyCallbackStruct. The reason sent by the callback is XmCR_FOCUS.
- XmNfontList
- Specifies the font list to be used for TextField. The font list is an obsolete structure, and is retained only for compatibility with earlier releases of Motif. Use the render table (XmNrenderTable) instead of font lists wherever possible. If both are specified, the render table will take precedence. If this value is NULL at initialization, the parent hierarchy of the widget is searched for an ancestor that holds the XmQTspecifyRenderTable trait. If such an ancestor is found, the font list is initialized to the XmTEXT_RENDER_TABLE value of the ancestor widget. If no such ancestor is found, the default is implementation dependent.
- TextField searches the font list for the first occurrence of a font set that has an XmFONTLIST_DEFAULT_TAG. If a default element is not found, the first font set in the font list is used. If the list contains no font sets, the first font in the font list will be used. Refer to XmFontList(3) for more information on a font list structure.
- XmNgainPrimaryCallback
- Specifies the list of callbacks that are called when the user invokes an event that causes the text widget to gain ownership of the primary selection. The callback reason for this callback is XmCR_GAIN_PRIMARY.
- XmNlosePrimaryCallback
- Specifies the list of callbacks that are called when the user invokes an event that cause the text widget to lose ownership of the primary selection. The callback reason for this callback is XmCR_LOSE_PRIMARY.
- XmNlosingFocusCallback
- Specifies the list of callbacks that are called before TextField widget loses input focus. The type of the structure whose address is passed to this callback is XmTextVerifyCallbackStruct. The reason sent by the callback is XmCR_LOSING_FOCUS.
- XmNmarginHeight
- Specifies the distance between the top edge of the widget window and the text, and the bottom edge of the widget window and the text.
- XmNmarginWidth
- Specifies the distance between the left edge of the widget window and the text, and the right edge of the widget window and the text.
- XmNmaxLength
- Specifies the maximum length of the text string that can be entered into text from the keyboard. This value must be nonnegative. Strings that are entered using the XmNvalue resource or the XmTextFieldSetString function ignore this resource.
- XmNmodifyVerifyCallback
- Specifies the list of callbacks that is called before text is deleted from or inserted into TextField. The type of the structure whose address is passed to this callback is XmTextVerifyCallbackStruct. The reason sent by the callback is XmCR_MODIFYING_TEXT_VALUE. When multiple TextField widgets share the same source, only the widget that initiates the source change will generate the XmNmodifyVerifyCallback.
- If both XmNmodifyVerifyCallback and XmNmodifyVerifyCallbackWcs are registered callback lists, the procedure(s) in the XmNmodifyVerifyCallback list is always executed first; and the resulting data, which may have been modified, is passed to the XmNmodifyVerifyCallbackWcs callback routines.
- XmNmodifyVerifyCallbackWcs
- Specifies the list of callbacks called before text is deleted from or inserted into Text. The type of the structure whose address is passed to this callback is XmTextVerifyCallbackStructWcs. The reason sent by the callback is XmCR_MODIFYING_TEXT_VALUE. When multiple TextField widgets share the same source, only the widget that initiates the source change will generate the XmNmodifyVerifyCallbackWcs.
- If both XmNmodifyVerifyCallback and XmNmodifyVerifyCallbackWcs are registered callback lists, the procedure(s) in the XmNmodifyVerifyCallback list is always executed first; and the resulting data, which may have been modified, is passed to the XmNmodifyVerifyCallbackWcs callback routines.
- XmNmotionVerifyCallback
- Specifies the list of callbacks that is called before the insert cursor is moved to a new position. The type of the structure whose address is passed to this callback is XmTextVerifyCallbackStruct. The reason sent by the callback is XmCR_MOVING_INSERT_CURSOR. It is possible for more than one XmNmotionVerifyCallbacks to be generated from a single action.
- XmNpendingDelete
- Indicates that pending delete mode is on when the Boolean is True. Pending deletion is defined as deletion of the selected text when an insertion is made.
- XmNrenderTable
- Specifies the render table to be used in deriving a font set or font for displaying text. If both a render table and a font list are specified, the render table will take precedence. If the value of XmNrenderTable is NULL at initialization, the parent hierarchy of the widget is searched for an ancestor that holds the XmQTspecifyRenderTable trait. If such an ancestor is found, the font list is initialized to the XmTEXT_RENDER_TABLE value of the ancestor widget. If no such ancestor is found, the default is implementation dependent.
- TextField searches the render table for the first occurrence of a rendition that has the tag _MOTIF_DEFAULT_LOCALE. If a default element is not found, the first rendition in the table is used. Refer to XmRenderTable(3) for more information on the render table structure.
- XmNresizeWidth
- Indicates that the TextField widget will attempt to resize its width to accommodate all the text contained in the widget when Boolean is True.
- XmNselectionArray
-
Defines the actions for multiple mouse clicks. Each mouse click
performed within some time of the previous mouse click will increment
the index into this array and perform the defined action for that
index. (This "multi-click" time is specified by the operating
environment, and varies among different systems. In general, it is
usually set to some fraction of a second.)
The possible actions are
-
- XmSELECT_POSITION
- Resets the insert cursor position
- XmSELECT_WORD
- Selects a word
- XmSELECT_LINE
- Selects a line of text
-
- XmNselectionArrayCount
- Specifies the number of actions that are defined in the XmNselectionArray resource. The value must not be negative.
- XmNselectThreshold
- Specifies the number of pixels of motion that is required to select the next character when selection is performed using the click-drag mode of selection. The value must not be negative. This resource also specifies whether a drag should be started and the number of pixels to start a drag when Btn2Down and Btn1Down are integrated.
- XmNvalue
- Specifies the string value of the TextField widget as a char* data value. Moves the cursor to position 0 unless a value of XmNcursorPosition was explicitly supplied in the argument list. If XmNvalue and XmNvalueWcs are both defined, the value of XmNvalueWcs supersedes that of XmNvalue. XtGetValues returns a copy of the value of the internal buffer and XtSetValues copies the string values into the internal buffer.
- XmNvalueChangedCallback
- Specifies the list of callbacks that is called after text is deleted from or inserted into TextField. The type of the structure whose address is passed to this callback is XmAnyCallbackStruct. The reason sent by the callback is XmCR_VALUE_CHANGED. The XmNvalueChangedCallback should occur only in pairs with a XmNmodifyVerifyCallback, assuming that the doit flag in the callback structure of the XmNmodifyVerifyCallback is not set to False.
- XmNvalueWcs
- Specifies the string value of the TextField widget as a wchar_t* data value. Moves the cursor to position 0 unless a value of XmNcursorPosition was explicitly supplied in the argument list.
- This resource cannot be specified in a resource file.
- If XmNvalue and XmNvalueWcs are both defined, the value of XmNvalueWcs supersedes that of XmNvalue. XtGetValues returns a copy of the value of the internal buffer encoded as a wide character string. XtSetValues copies the value of the wide character string into the internal buffer.
- XmNverifyBell
- Specifies whether a bell will sound when an action is reversed during a verification callback. The default depends on the value of the ancestor VendorShell's XmNaudibleWarning resource.
Inherited Resources
TextField widget inherits behavior and resources from the superclasses in the following tables. For a complete description of these resources, refer to the reference page for that superclass.
|
|
Callback Information
A pointer to the following structure is passed to each callback:
typedef struct { int reason; XEvent * event; } XmAnyCallbackStruct;
- reason
- Indicates why the callback was invoked
- event
- Points to the XEvent that triggered the callback
The TextField widget defines a new callback structure for use with verification callbacks. Note that not all of the fields are relevant for every callback reason. The application must first look at the reason field and use only the structure members that are valid for the particular reason. The values startPos, endPos, and text in the callback structure XmTextVerifyCallbackStruct may be modified upon receiving the callback, and these changes will be reflected as the change made to the source of the TextField widget. (For example, all keystrokes can be converted to spaces or NULL characters when a password is entered into a TextField widget.) The application programmer should not overwrite the text field, but should attach data to that pointer.
A pointer to the following structure is passed to the callbacks for XmNlosingFocusCallback, XmNmodifyVerifyCallback, and XmNmotionVerifyCallback.
typedef struct { int reason; XEvent *event; Boolean doit; XmTextPosition currInsert, newInsert; XmTextPosition startPos, endPos; XmTextBlock text; } XmTextVerifyCallbackStruct, *XmTextVerifyPtr;
- reason
- Indicates why the callback was invoked.
- event
- Points to the XEvent the triggered the callback. It can be NULL. For example, changes made to the Text widget programmatically do not have an event that can be passed to the associated callback.
- doit
- Indicates whether the action that invoked the callback will be performed. Setting doit to False negates the action. Note that not all actions may be negated. For example, XmCR_LOSING_FOCUS callbacks may be beyond the control of the widget if they are produced by mouse clicks.
- currInsert
- Indicates the current position of the insert cursor.
- newInsert
- Indicates the position at which the user attempts to position the insert cursor.
- startPos
- Indicates the starting position of the text to modify. If the callback is not a modify verification callback, this value is the same as currInsert.
- endPos
- Indicates the ending position of the text to modify. If no text is replaced or deleted, then the value is the same as startPos. If the callback is not a modify verification callback, this value is the same as currInsert.
- text
- Points to the following structure of type XmTextBlockRec. This structure holds the textual information to be inserted.
typedef struct { char *ptr; int length; XmTextFormat format } XmTextBlockRec, *XmTextBlock;
-
- ptr
- The text to be inserted. ptr points to a temporary storage space that is reused after the callback is finished. Therefore, if an application needs to save the text to be inserted, it should copy the text into its own data space.
- length
- Specifies the length of the text to be inserted.
- format
- Specifies the format of the text, either XmFMT_8_BIT or XmFMT_16_BIT.
A pointer to the following structure is passed to callbacks for XmNmodifyVerifyCallbackWcs.
typedef struct { int reason; XEvent *event; Boolean doit; XmTextPosition currInsert, newInsert; XmTextPosition startPos, endPos; XmWcsTextBlock text; } XmTextVerifyCallbackStructWcs, *XmTextVerifyPtrWcs;
- reason
- Indicates why the callback was invoked.
- event
- Points to the XEvent that triggered the callback. It can be NULL. For example, changes made to the Text widget programmatically do not have an event that can be passed to the associated callback.
- doit
- Indicates whether the action that invoked the callback is performed. Setting doit to False negates the action. Note that not all actions may be negated. For example, XmCR_LOSING_FOCUS callbacks may be beyond the control of the widget if they are produced by mouse clicks.
- currInsert
- Indicates the current position of the insert cursor.
- newInsert
- Indicates the position at which the user attempts to position the insert cursor.
- startPos
- Indicates the starting position of the text to modify. If the callback is not a modify verification callback, this value is the same as currInsert.
- endPos
- Indicates the ending position of the text to modify. If no text is replaced or deleted, the value is the same as startPos. If the callback is not a modify verification callback, this value is the same as currInsert.
- text
- Points to the following structure of type XmTextBlockRecWcs. This structure holds the textual information to be inserted.
typedef struct { wchar_t *wcsptr; int length; } XmTextBlockRecWcs, *XmTextBlockWcs;
-
- wcsptr
- Points to the wide character text to be inserted
- length
- Specifies the number of characters to be inserted
The following table describes the reasons for which the individual verification callback structure fields are valid. Note that the event field will never be valid for XmCR_MOVING_INSERT_CURSOR.
|
A pointer to the following callback structure is passed to the XmNdestinationCallback procedures:
typedef struct { int reason; XEvent *event; Atom selection; XtEnum operation; int flags; XtPointer transfer_id; XtPointer destination_data; XtPointer location_data; Time time; } XmDestinationCallbackStruct;
- reason
- Indicates why the callback was invoked.
- event
- Points to the XEvent that triggered the callback. It can be NULL.
- selection
- Indicates the selection for which data transfer is being requested. Possible values are CLIPBOARD, PRIMARY, SECONDARY, and _MOTIF_DROP.
- operation
-
Indicates the type of transfer operation requested.
-
- •
- When the selection is PRIMARY or SECONDARY, possible values are XmMOVE, XmCOPY, and XmLINK.
- •
- When the selection is CLIPBOARD, possible values are XmCOPY and XmLINK.
- •
- When the selection is _MOTIF_DROP, possible values are XmMOVE, XmCOPY, XmLINK, and XmOTHER. A value of XmOTHER means that the callback procedure must get further information from the XmDropProcCallbackStruct in the destination_data member.
-
- flags
-
Indicates whether or not the destination widget is also the source of
the data to be transferred.
Following are the possible values:
-
- XmCONVERTING_NONE
- The destination widget is not the source of the data to be transferred.
- XmCONVERTING_SAME
- The destination widget is the source of the data to be transferred.
-
- transfer_id
- Serves as a unique ID to identify the transfer transaction.
- destination_data
- Contains information about the destination. When the selection is _MOTIF_DROP, the callback procedures are called by the drop site's XmNdropProc, and destination_data is a pointer to the XmDropProcCallbackStruct passed to the XmNdropProc procedure. When the selection is SECONDARY, destination_data is an Atom representing a target recommmended by the selection owner for use in converting the selection. Otherwise, destination_data is NULL.
- location_data
- Contains information about the location where data is to be transferred. The value is always NULL when the selection is CLIPBOARD. If the value is NULL, the data is to be inserted at the widget's cursor position. Otherwise, the value is a pointer to an XPoint structure containing the x and y coordinates at the location where the data is to be transferred. Once XmTransferDone procedures start to be called, location_data will no longer be stable.
- time
- Indicates the time when the transfer operation began.
Translations
The XmTextField translations are described in the following list. The actions represent the effective behavior of the associated events, and they may differ in a right-to-left language environment.
The following key names are listed in the X standard key event translation table syntax. This format is the one used by Motif to specify the widget actions corresponding to a given key. A brief overview of the format is provided under VirtualBindings(3). For a complete description of the format, please refer to the X Toolkit Instrinsics Documentation.
- ≈c s ≈m ≈a <Btn1Down>:
- extend-start()
- c ≈s ≈m ≈a <Btn1Down>:
- move-destination()
- ≈c ≈s ≈m ≈a <Btn1Down>:
- grab-focus()
- ≈c ≈m ≈a <Btn1Motion>:
- extend-adjust()
- ≈c ≈m ≈a <Btn1Up>:
- extend-end()
- <Btn2Down>:
- process-bdrag()
- m ≈a <Btn2Motion>:
- secondary-adjust()
- ≈m a <Btn2Motion>:
- secondary-adjust()
- s c <Btn2Up>:
- link-to()
- ≈s <Btn2Up>:
- copy-to()
- ≈c <Btn2Up>:
- move-to()
- :m <Key><osfPrimaryPaste>:
- cut-primary()
- :a <Key><osfPrimaryPaste>:
- cut-primary()
- :<Key><osfPrimaryPaste>:
- copy-primary()
- :m <Key><osfCut>:
- cut-primary()
- :a <Key><osfCut>:
- cut-primary()
- :<Key><osfCut>:
- cut-clipboard()
- :<Key><osfPaste>:
- paste-clipboard()
- :m <Key><osfCopy>:
- copy-primary()
- :a <Key><osfCopy>:
- copy-primary()
- :<Key><osfCopy>:
- copy-clipboard()
- :s <Key><osfBeginLine>:
- beginning-of-line(extend)
- :<Key><osfBeginLine>:
- beginning-of-line()
- :s <Key><osfEndLine>:
- end-of-line(extend)
- :<Key><osfEndLine>:
- end-of-line()
- :s <Key><osfPageLeft>:
- page-left(extend)
- :<Key><osfPageLeft>:
- page-left()
- :s c<Key><osfPageUp>:
- page-left(extend)
- :c <Key><osfPageUp>:
- page-left()
- :s <Key><osfPageRight>:
- page-right(extend)
- :<Key><osfPageRight>:
- page-right()
- s c <Key><osfPageDown>:
- page-right(extend)
- :c <Key><osfPageDown>:
- page-right()
- :<Key><osfClear>:
- clear-selection()
- :<Key><osfBackSpace>:
- delete-previous-character()
- :s m <Key><osfDelete>:
- cut-primary()
- :s a <Key><osfDelete>:
- cut-primary()
- :s <Key><osfDelete>:
- cut-clipboard()
- :c <Key><osfDelete>:
- delete-to-end-of-line()
- :<Key><osfDelete>:
- delete-next-character()
- :c m <Key><osfInsert>:
- copy-primary()
- :c a <Key><osfInsert>:
- copy-primary()
- :s <Key><osfInsert>:
- paste-clipboard()
- :c <Key><osfInsert>:
- copy-clipboard()
- :<Key><osfInsert>:
- toggle-overstrike()
- :s <Key><osfSelect>:
- key-select()
- :<Key><osfSelect>:
- set-anchor()
- :<Key><osfSelectAll>:
- select-all()
- :<Key><osfDeselectAll>:
- deselect-all()
- :<Key><osfActivate>:
- activate()
- :<Key><osfAddMode>:
- toggle-add-mode()
- :<Key><osfHelp>:
- Help()
- :<Key><osfCancel>:
- process-cancel()
- :s c <Key><osfLeft>:
- backward-word(extend)
- :c <Key><osfLeft>:
- backward-word()
- :s <Key><osfLeft>:
- key-select(left)
- :<Key><osfLeft>:
- backward-character()
- :s c <Key><osfRight>:
- forward-word(extend)
- :c <Key><osfRight>:
- forward-word()
- :s <Key><osfRight>:
- key-select(right)
- :<Key><osfRight>:
- forward-character()
- :<Key><osfUp>:
- traverse-prev()
- :<Key><osfDown>:
- traverse-next()
- c ≈m ≈a <Key>slash:
- select-all()
- c ≈m ≈a <Key>backslash:
- deselect-all()
- s ≈m ≈a <Key>Tab:
- prev-tab-group()
- ≈m ≈a <Key>Tab:
- next-tab-group()
- ≈s ≈m ≈a <Key>Return:
- activate()
- c ≈s ≈m ≈a <Key>space:
- set-anchor()
- c s ≈m ≈a <Key>space:
- key-select()
- s ≈c ≈m ≈a <Key>space:
- self-insert()
- <Key>:
- self-insert()
The TextField button event translations are modified when Display's XmNenableBtn1Transfer resource does not have a value of XmOFF (in other words, it is either XmBUTTON2_TRANSFER or XmBUTTON2_ADJUST). This option allows the actions for selection and transfer to be integrated on <Btn1>. The actions for <Btn1> that are defined above still apply when the <Btn1> event occurs over text that is not selected. The following actions apply when the <Btn1> event occurs over text that is selected:
- <Btn1Down>:
- process-bdrag().
- <Shift><Btn1Down>:
- process-bdrag().
- <Btn1Down><Shift><Btn1Up>:
- grab-focus(), extend-end.
- <Shift><Btn1Down><Shift><Btn1Up>:
- extend-start(), extend-end().
- <Ctrl><Btn1Down><Shift><Btn1Up>:
- move-destination().
- <Ctrl><Btn1Down>:
- process-bdrag().
When Display's XmNenableBtn1Transfer resource has a value of XmBUTTON2_ADJUST, the following actions apply:
- <Btn2Down>:
- extend-start().
- <Btn2Motion>:
- extend-adjust().
- <Btn2Up>:
- extend-end().
Action Routines
The XmTextField action routines are
- activate():
- Calls the callbacks for XmNactivateCallback. If the parent is a manager, passes the event to the parent.
- backward-character(extend):
- Moves the insertion cursor one character to the left. This action may have different behavior in a right-to-left language environment.
- If called with an argument of extend, moves the insertion cursor as in the case of no argument and extends the current selection.
- The backward-character() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. If called with the extend argument, the backward-character() action may produce calls to the XmNgainPrimaryCallback procedures. See callback description for more information.
- backward-word(extend):
- If this action is called with no argument, moves the insertion cursor to the first non-whitespace character after the first whitespace character to the left or after the beginning of the line. If the insertion cursor is already at the beginning of a word, moves the insertion cursor to the beginning of the previous word. This action may have different behavior in a locale other than the C locale.
- If called with an argument of extend, moves the insertion cursor as in the case of no argument and extends the current selection.
- The backward-word() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. If called with the extend argument, the backward-word() action may produce calls to the XmNgainPrimaryCallback procedures. See callback description for more information.
- beginning-of-line(extend):
- If this action is called with no argument, moves the insertion cursor to the beginning of the line.
- If called with an argument of extend, moves the insertion cursor as in the case of no argument and extends the current selection.
- The beginning-of-line() action produces calls to the XmNmotionVerifyCallback with reason value XmCR_MOVING_INSERT_CURSOR. If called with the extend argument, the beginning-of-line() action may produce calls to the XmNgainPrimaryCallback procedures. See callback description for more information.
- clear-selection():
- Clears the current selection by replacing each character except <Return> with a <space> character.
- The clear-selection() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE and the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED.
- copy-clipboard():
- If this widget owns the primary selection, this action copies the selection to the clipboard. This action calls the XmNconvertCallback procedures, possibly multiple times, for the CLIPBOARD selection.
- copy-primary():
- Copies the primary selection to just before the insertion cursor. This action calls the XmNdestinationCallback procedures for the PRIMARY selection and the XmCOPY operation. It calls the selection owner's XmNconvertCallback procedures, possibly multiple times, for the PRIMARY selection.
- In addition, the copy-primary() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, the XmNvalueChangedCallback with reason value XmCR_VALUE_CHANGED, and the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. The copy-primary() action may produce calls to the XmNgainPrimaryCallback procedures. See callback description for more information.
- copy-to():
- If a secondary selection exists, this action copies the secondary selection to the insertion position of the destination component. If the primary selection is in the destination widget, it will be deselected. Otherwise, there is no effect on the primary selection.
- This action calls the destination's XmNdestinationCallback procedures for the SECONDARY selection and the XmCOPY operation. The destination's XmNdestinationCallback procedures or the destination component itself invokes the selection owner's XmNconvertCallback procedures, possibly multiple times, for the SECONDARY selection.
- If no secondary selection exists, this action copies the primary selection to the pointer position. This action calls the XmNdestinationCallback procedures for the PRIMARY selection and the XmCOPY operation. It calls the selection owner's XmNconvertCallback procedures, possibly multiple times, for the PRIMARY selection.
- In addition, the copy-to() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED, and the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. If there is no secondary selection, the copy-to() action may produce calls to the XmNgainPrimaryCallback procedures. See callback description for more information.
- cut-clipboard():
- If this widget owns the primary selection, this action cuts the selection to the clipboard. This action calls the XmNconvertCallback procedures, possibly multiple times, for the CLIPBOARD selection. If the transfer is successful, this action then calls the XmNconvertCallback procedures for the CLIPBOARD selection and the DELETE target.
- In addition, the cut-clipboard() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, and the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED.
- cut-primary():
- Cuts the primary selection and pastes it just before the insertion cursor. This action calls the XmNdestinationCallback procedures for the PRIMARY selection and the XmMOVE operation. It calls the selection owner's XmNconvertCallback procedures, possibly multiple times, for the PRIMARY selection. If the transfer is successful, this action then calls the selection owner's XmNconvertCallback procedures for the PRIMARY selection and the DELETE target.
- In addition, the cut-primary() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR, the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, and the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED.
- delete-next-character():
- In normal mode, if there is a nonnull selection, deletes the selection; otherwise, deletes the character following the insertion cursor. In add mode, if there is a nonnull selection, the cursor is not disjoint from the selection and XmNpendingDelete is set to True, deletes the selection; otherwise, deletes the character following the insertion cursor. This may impact the selection.
- The delete-next-character() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, and the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED.
- delete-next-word():
- In normal mode, if there is a nonnull selection, deletes the selection; otherwise, deletes the characters following the insertion cursor to the next space, tab or end-of-line character. In add mode, if there is a nonnull selection, the cursor is not disjoint from the selection and XmNpendingDelete is set to True, deletes the selection; otherwise, deletes the characters following the insertion cursor to the next space, tab or end-of-line character. This may impact the selection. This action may have different behavior in a locale other than the C locale.
- The delete-next-word() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, and the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED.
- delete-previous-character():
- In normal mode, if there is a nonnull selection, deletes the selection; otherwise, deletes the character of text immediately preceding the insertion cursor. In add mode, if there is a nonnull selection, the cursor is not disjoint from the selection and XmNpendingDelete is set to True, deletes the selection; otherwise, deletes the character of text immediately preceding the insertion cursor. This may impact the selection.
- The delete-previous-character() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED, and the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR.
- delete-previous-word():
- In normal mode, if there is a nonnull selection, deletes the selection; otherwise, deletes the characters preceding the insertion cursor to the next space, tab or beginning-of-line character. In add mode, if there is a nonnull selection, the cursor is not disjoint from the selection and XmNpendingDelete is set to True, deletes the selection; otherwise, deletes the characters preceding the insertion cursor to the next space, tab or beginning-of-line character. This may impact the selection. This action may have different behavior in a locale other than the C locale.
- The delete-previous-word() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED, and the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR.
- delete-selection():
- Deletes the current selection.
- The delete-selection() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED, and the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR.
- delete-to-end-of-line():
- In normal mode, if there is a nonnull selection, deletes the selection; otherwise, deletes the characters following the insertion cursor to the next end of line character. In add mode, if there is a nonnull selection, the cursor is not disjoint from the selection and XmNpendingDelete is set to True, deletes the selection; otherwise, deletes the characters following the insertion cursor to the next end of line character. This may impact the selection.
- The delete-to-end-of-line() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, and the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED.
- delete-to-start-of-line():
- In normal mode, if there is a nonnull selection, deletes the selection; otherwise, deletes the characters preceding the insertion cursor to the previous beginning-of-line character. In add mode, if there is a nonnull selection, the cursor is not disjoint from the selection and XmNpendingDelete is set to True, deletes the selection; otherwise, deletes the characters preceding the insertion cursor to the previous beginning-of-line character. This may impact the selection.
- The delete-to-start-of-line() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED, and the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR.
- deselect-all():
- Deselects the current selection.
- The deselect-all() action produces no callbacks.
- end-of-line(extend):
- If this action is called with no argument, moves the insertion cursor to the end of the line. If called with an argument of extend, moves the insertion cursor as in the case of no argument and extends the current selection.
- The end-of-line() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. If called with the extend argument, the end-of-line() action may produce calls to the XmNgainPrimaryCallback procedures. See callback description for more information.
- extend-adjust():
- Selects text from the anchor to the pointer position and deselects text outside that range.
- The extend-adjust() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. The extend-adjust() action may produce calls to the XmNgainPrimaryCallback procedures. See callback description for more information.
- extend-end():
- Moves the insertion cursor to the position of the pointer. The extend-end() action is used to commit the selection. After this action has been done, process-cancel() will no longer cancel the selection.
- The extend-end() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. The extend-end() action may produce calls to the XmNgainPrimaryCallback procedures. See callback description for more information.
- extend-start():
- Adjusts the anchor using the balance-beam method. Selects text from the anchor to the pointer position and deselects text outside that range.
- The extend-start() action can produce no callbacks, however, it may produce calls to the XmNgainPrimaryCallback and XmNmotionVerifyCallback procedures. See callback description for more information.
- forward-character(extend):
- Moves the insertion cursor one character to the right. This action may have different behavior in a right-to-left language environment.
- If called with an argument of extend, moves the insertion cursor as in the case of no argument and extends the current selection.
- The forward-character() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. If called with the extend argument, the forward-character() action may produce calls to the XmNgainPrimaryCallback procedures. See callback description for more information.
- forward-word(extend):
- If this action is called with no argument, moves the insertion cursor to the first whitespace character or end-of-line following the next non-whitespace character. If the insertion cursor is already at the end of a word, moves the insertion cursor to the end of the next word. This action may have different behavior in a locale other than the C locale.
- If called with an argument of extend, moves the insertion cursor as in the case of no argument and extends the current selection.
- The forward-word() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. If called with the extend argument, the forward-word() action may produce calls to the XmNgainPrimaryCallback procedures. See callback description for more information.
- grab-focus():
- This key binding performs the action defined in the XmNselectionArray, depending on the number of multiple mouse clicks. The default selection array ordering is one click to move the insertion cursor to the pointer position, two clicks to select a word, and three clicks to select a line of text. A single click also deselects any selected text and sets the anchor at the pointer position. This action may have different behavior in a locale other than the C locale.
- The grab-focus() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR.
- Help():
- Calls the callbacks for XmNhelpCallback if any exist. If there are no help callbacks for this widget, this action calls the help callbacks for the nearest ancestor that has them.
- key-select(right|left):
- If called with an argument of right, moves the insertion cursor one character to the right and extends the current selection. If called with an argument of left, moves the insertion cursor one character to the left and extends the current selection. If called with no argument, extends the current selection.
- Note that after a key-select action, the selection will still begin at the original anchor, and will extend to the position indicated in the action call. If this new position is on the opposite side of the selection anchor from the previous selection boundary, the original selection will be deselected.
- The key-select() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. The key-select() action may also produce calls to the XmNgainPrimaryCallback procedures. See callback description for more information.
- link-primary():
- Places a link to the primary selection just before the insertion cursor. This action calls the XmNdestinationCallback procedures for the PRIMARY selection and the XmLINK operation. The TextField widget itself performs no transfers; the XmNdestinationCallback procedures are responsible for inserting the link to the primary selection and for taking any related actions.
- link-to():
- If a secondary selection exists, this action places a link to the secondary selection at the insertion position of the destination component. This action calls the destination's XmNdestinationCallback procedures for the SECONDARY selection and the XmLINK operation.
- If no secondary selection exists, this action places a link to the primary selection at the pointer position. This action calls the XmNdestinationCallback procedures for the PRIMARY selection and the XmLINK operation.
- The TextField widget itself performs no transfers; the XmNdestinationCallback procedures are responsible for inserting the link to the primary or secondary selection and for taking any related actions.
- move-destination():
- Moves the insertion cursor to the pointer position without changing any existing current selection. If there is a current selection, sets the widget as the destination widget. This also moves the widget focus to match the insertion cursor.
- The move-destination() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR.
- move-to():
- If a secondary selection exists, this action moves the secondary selection to the insertion position of the destination component. If the secondary selection is in the destination widget, and the secondary selection and the primary selection overlap, the result is undefined. This action calls the destination's XmNdestinationCallback procedures for the SECONDARY selection and the XmCOPY operation. The destination's XmNdestinationCallback procedures or the destination component itself invokes the selection owner's XmNconvertCallback procedures, possibly multiple times, for the SECONDARY selection. If the transfer is successful, this action then calls the selection owner's XmNconvertCallback procedures for the SECONDARY selection and the DELETE target.
- If no secondary selection exists, this action moves the primary selection to the pointer position. This action calls the XmNdestinationCallback procedures for the PRIMARY selection and the XmMOVE operation. It calls the selection owner's XmNconvertCallback procedures, possibly multiple times, for the PRIMARY selection. If the transfer is successful, this action then calls the selection owner's XmNconvertCallback procedures for the PRIMARY selection and the DELETE target.
- In addition, the move-to() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED, and the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. This action may also produce calls to the XmNgainPrimaryCallback procedures.
- next-tab-group():
- Traverses to the next tab group.
- The next-tab-group() action produces no callbacks, unless it results in the widget losing focus, in which case, the XmNlosingFocusCallback procedures are called with reason value XmCR_LOSING_FOCUS.
- page-left():
- Scrolls the viewing window left one page of text.
- The page-left() action produces no callbacks.
- page-right():
- Scrolls the viewing window right one page of text.
- The page-right() action produces no callbacks.
- paste-clipboard():
- Pastes the contents of the clipboard before the insertion cursor. This action calls the XmNdestinationCallback procedures for the CLIPBOARD selection and the XmCOPY operation.
- The paste-clipboard() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED, and the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR.
- prev-tab-group():
- Traverses to the previous tab group.
- The prev-tab-group() action produces no callbacks, unless it results in the widget losing focus, in which case, the XmNlosingFocusCallback procedures are called with reason value XmCR_LOSING_FOCUS.
- process-bdrag()
- If the pointer is within the selection, this action starts a drag operation for the selection. This action sets the XmNconvertProc of the DragContext to a function that calls the XmNconvertCallback procedures, possibly multiple times, for the _MOTIF_DROP selection.
- If no selection exists or the pointer is outside the selection, this action prepares to start a secondary selection at the pointer position.
- process-cancel():
- Cancels the current extend-adjust(), secondary-adjust() or process-bdrag() operation and leaves the selection state as it was before the operation; otherwise, and if the parent is a manager, it passes the event to the parent.
- secondary-adjust():
- Extends the secondary selection to the pointer position.
- The secondary-adjust() action produces no callbacks.
- secondary-start():
- Marks the beginning of a secondary selection.
- The secondary-start() action produces no callbacks.
- select-all():
- Selects all text.
- The select-all() action can produce no callbacks, however, it may produce calls to the XmNgainPrimaryCallback and XmNmotionVerifyCallback procedures. See callback description for more information.
- self-insert():
- If XmNpendingDelete is True and the cursor is not disjoint from the current selection, deletes the entire selection. Inserts the character associated with the key pressed before the insertion cursor.
- The self-insert() action produces calls to the XmNmodifyVerifyCallback procedures with reason value XmCR_MODIFYING_TEXT_VALUE, the XmNvalueChangedCallback procedures with reason value XmCR_VALUE_CHANGED, and the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR.
- set-anchor():
- Resets the anchor point for extended selections. Resets the destination of secondary selection actions.
- The set-anchor() action produces no callbacks.
- toggle-add-mode():
- Toggles the state of Add Mode.
- The toggle-add-mode() action produces no callbacks.
- toggle-overstrike():
- Toggles the state of the text insertion mode. By default, characters typed into the TextField widget are inserted before the position of the insertion cursor. In overstrike mode, characters entered into the TextField widget replace the characters that directly follow the insertion cursor. In overstrike mode, when the end of a line is reached, characters are appended to the end of the line.
- The following traversal actions generate no callbacks unless they result in the loss of focus by the widget in question, as when XmNnavigationType is XmNONE. In this case, they produce calls to the XmNlosingFocusCallback procedures, with reason value XmCR_FOCUS_MOVED.
- traverse-home():
- Traverses to the first widget in the tab group.
- traverse-next():
- Traverses to the next widget in the tab group.
- traverse-prev():
- Traverses to the previous widget in the tab group.
Additional Behavior
This widget has the following additional behavior:
- <FocusIn>:
- Draws the insertion cursor as solid and starts blinking the cursor.
- <FocusOut>:
- Displays the insertion cursor as a stippled I-beam unless it is the destination widget.
Virtual Bindings
The bindings for virtual keys are vendor specific. For information about bindings for virtual buttons and keys, see VirtualBindings(3).
RELATED
Core(3), XmCreateTextField(3), XmFontList(3), XmFontListAppendEntry(3), XmPrimitive(3), XmTextFieldClearSelection(3), XmTextFieldCopy(3), XmTextFieldCopyLink(3), XmTextFieldCut(3), XmTextFieldGetBaseline(3), XmTextFieldGetEditable(3), XmTextFieldGetInsertionPosition(3), XmTextFieldGetLastPosition(3), XmTextFieldGetMaxLength(3), XmTextFieldGetSelection(3), XmTextFieldGetSelectionPosition(3), XmTextFieldGetSelectionWcs(3), XmTextFieldGetString(3), XmTextFieldGetStringWcs(3), XmTextFieldGetSubstring(3), XmTextFieldGetSubstringWcs(3), XmTextFieldInsert(3), XmTextFieldInsertWcs(3), XmTextFieldPaste(3), XmTextFieldPasteLink(3), XmTextFieldPosToXY(3), XmTextFieldRemove(3), XmTextFieldReplace(3), XmTextFieldReplaceWcs(3), XmTextFieldSetAddMode(3), XmTextFieldSetEditable(3), XmTextFieldSetHighlight(3), XmTextFieldSetInsertionPosition(3), XmTextFieldSetMaxLength(3), XmTextFieldSetSelection(3), XmTextFieldSetString(3), XmTextFieldSetStringWcs(3), XmTextFieldShowPosition(3), XmTextFieldXYToPos(3), XmVaCreateTextField(3), and XmVaCreateManagedTextField(3).