DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

XmTextField(X3mot)


XmTextField -- the TextField class

Synopsis

#include <Xm/TextF.h>

Description

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 widget 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.

Classes

TextField widget inherits behavior and resources from Core and Primitive classes.

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).

xmTextFieldResource set

Name Class Type Default Access
XmNactivateCallback XmCCallback XtCallbackList NULL C
XmNblinkRate XmCBlinkRate int 500 CSG
XmNcolumns XmCColumns short dynamic CSG
XmNcursorPosition XmCCursorPosition XmTextPosition 0 CSG
XmNcursorPositionVisible XmCCursorPositionVisible Boolean True CSG
XmNeditable XmCEditable Boolean True CSG
XmNfocusCallback XmCCallback XtCallbackList NULL C
XmNfontList XmCFontList XmFontList dynamic CSG
XmNgainPrimaryCallback XmCCallback XtCallbackList NULL C
XmNlosePrimaryCallback XmCCallback XtCallbackList NULL C
XmNlosingFocusCallback XmCCallback XtCallbackList NULL C
XmNmarginHeight XmCMarginHeight Dimension 5 CSG
XmNmarginWidth XmCMarginWidth Dimension 5 CSG
XmNmaxLength XmCMaxLength int largest integer CSG
XmNmodifyVerifyCallback XmCCallback XtCallbackList NULL C
XmNmodifyVerifyCallbackWcs XmCCallback XtCallbackList NULL C
XmNmotionVerifyCallback XmCCallback XtCallbackList NULL C
XmNpendingDelete XmCPendingDelete Boolean True CSG
XmNresizeWidth XmCResizeWidth Boolean False CSG
XmNselectionArray XmCSelectionArray XtPointer default array CSG
XmNselectionArrayCount XmCSelectionArrayCount int 3 CSG
XmNselectThreshold XmCSelectThreshold int 5 CSG
XmNvalue XmCValue String "" CSG
XmNvalueChangedCallback XmCCallback XtCallbackList NULL C
XmNvalueWcs XmCValueWcs wchar_t* (wchar_t *)"" CSG+
XmNverifyBell XmCVerifyBell Boolean dynamic CSG

 +---------------------------+--------------------------+----------------+-----------------+--------+
 |Name                       | Class                    | Type           | Default         | Access |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNactivateCallback        | XmCCallback              | XtCallbackList | NULL            | C      |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNblinkRate               | XmCBlinkRate             | int            | 500             | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNcolumns                 | XmCColumns               | short          | dynamic         | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNcursorPosition          | XmCCursorPosition        | XmTextPosition | 0               | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNcursorPositionVisible   | XmCCursorPositionVisible | Boolean        | True            | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNeditable                | XmCEditable              | Boolean        | True            | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNfocusCallback           | XmCCallback              | XtCallbackList | NULL            | C      |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNfontList                | XmCFontList              | XmFontList     | dynamic         | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNgainPrimaryCallback     | XmCCallback              | XtCallbackList | NULL            | C      |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNlosePrimaryCallback     | XmCCallback              | XtCallbackList | NULL            | C      |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNlosingFocusCallback     | XmCCallback              | XtCallbackList | NULL            | C      |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNmarginHeight            | XmCMarginHeight          | Dimension      | 5               | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNmarginWidth             | XmCMarginWidth           | Dimension      | 5               | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNmaxLength               | XmCMaxLength             | int            | largest integer | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNmodifyVerifyCallback    | XmCCallback              | XtCallbackList | NULL            | C      |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNmodifyVerifyCallbackWcs | XmCCallback              | XtCallbackList | NULL            | C      |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNmotionVerifyCallback    | XmCCallback              | XtCallbackList | NULL            | C      |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNpendingDelete           | XmCPendingDelete         | Boolean        | True            | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNresizeWidth             | XmCResizeWidth           | Boolean        | False           | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNselectionArray          | XmCSelectionArray        | XtPointer      | default array   | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNselectionArrayCount     | XmCSelectionArrayCount   | int            | 3               | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNselectThreshold         | XmCSelectThreshold       | int            | 5               | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNvalue                   | XmCValue                 | String         | ""              | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNvalueChangedCallback    | XmCCallback              | XtCallbackList | NULL            | C      |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNvalueWcs                | XmCValueWcs              | wchar_t*       | (wchar_t *)""   | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
 |XmNverifyBell              | XmCVerifyBell            | Boolean        | dynamic         | CSG    |
 +---------------------------+--------------------------+----------------+-----------------+--------+
+ 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() function. 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 (i.e., the time it will take to blink the insertion cursor on and off will be 2 times the blink rate). The cursor will not blink when the blink rate is set to 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 maximum character width of the associated font. For proportionate fonts, the actual number of characters that fit on a given line may be greater than the value specified. The value must be greater than 0. The default value depends on the value of the XmNwidth resource. If no width is specified the default is 20.

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
Indicates that the insert cursor position is marked by a blinking text cursor when the Boolean is True.

XmNeditable
Indicates that the user can edit the text string when set to True. A false value will prohibit the user from editing the text.

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. If this value is NULL at initialization, it is initialized by looking up the parent hierarchy of the widget for an ancestor that is a subclass of the XmBulletinBoard or VendorShell widget class. If such an ancestor is found, the font list is initialized to the XmNtextFontList of the ancestor widget. If no such ancestor is found, the default is implementation dependent. Refer to XmFontList(X3mot) for more information on a font list structure.

TextField searches the font list for the first occurrence of a font set that has a 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 is used.


XmNgainPrimaryCallback
Specifies the list of callbacks that are called when the user invokes an event that cause 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 is 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 text, and the top and bottom edges of the widget window.

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 non-negative. 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 are 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 are 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 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.

XmNresizeWidth
Indicates that 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 a half of a second of the previous mouse click will increment the index into this array and perform the defined action for that index. The possible actions are:

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.

XmNvalue
Specifies the string value of the TextField widget as a char data value. 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. When multiple TextField widgets share the same source, only the widget that initiates the source change will generate the XmNvalueChangedCallback. This callback represents a change in the source in the TextField, not in the TextField widget. 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 char_t* data value. 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 following superclasses. For a complete description of these resources, refer to the man page for that superclass.

XmPrimitive resource set

Name Class Type Default Access
XmNbottomShadowColor XmCBottomShadowColor Pixel dynamic CSG
XmNbottomShadowPixmap XmCBottomShadowPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNforeground XmCForeground Pixel dynamic CSG
XmNhelpCallback XmCCallback XtCallbackList NULL C
XmNhighlightColor XmCHighlightColor Pixel dynamic CSG
XmNhighlightOnEnter XmCHighlightOnEnter Boolean False CSG
XmNhighlightPixmap XmCHighlightPixmap Pixmap dynamic CSG
XmNhighlightThickness XmCHighlightThickness Dimension 2 CSG
XmNnavigationType XmCNavigationType XmNavigationType XmTAB_GROUP CSG
XmNshadowThickness XmCShadowThickness Dimension 2 CSG
XmNtopShadowColor XmCTopShadowColor Pixel dynamic CSG
XmNtopShadowPixmap XmCTopShadowPixmap Pixmap dynamic CSG
XmNtraversalOn XmCTraversalOn Boolean True CSG
XmNunitType XmCUnitType unsigned char dynamic CSG
XmNuserData XmCUserData XtPointer NULL CSG

 +----------------------+-----------------------+------------------+----------------------+--------+
 |Name                  | Class                 | Type             | Default              | Access |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNbottomShadowColor  | XmCBottomShadowColor  | Pixel            | dynamic              | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNbottomShadowPixmap | XmCBottomShadowPixmap | Pixmap           | XmUNSPECIFIED_PIXMAP | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNforeground         | XmCForeground         | Pixel            | dynamic              | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNhelpCallback       | XmCCallback           | XtCallbackList   | NULL                 | C      |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNhighlightColor     | XmCHighlightColor     | Pixel            | dynamic              | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNhighlightOnEnter   | XmCHighlightOnEnter   | Boolean          | False                | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNhighlightPixmap    | XmCHighlightPixmap    | Pixmap           | dynamic              | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNhighlightThickness | XmCHighlightThickness | Dimension        | 2                    | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNnavigationType     | XmCNavigationType     | XmNavigationType | XmTAB_GROUP          | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNshadowThickness    | XmCShadowThickness    | Dimension        | 2                    | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNtopShadowColor     | XmCTopShadowColor     | Pixel            | dynamic              | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNtopShadowPixmap    | XmCTopShadowPixmap    | Pixmap           | dynamic              | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNtraversalOn        | XmCTraversalOn        | Boolean          | True                 | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNunitType           | XmCUnitType           | unsigned char    | dynamic              | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+
 |XmNuserData           | XmCUserData           | XtPointer        | NULL                 | CSG    |
 +----------------------+-----------------------+------------------+----------------------+--------+

Core resource set

Name Class Type Default Access
XmNaccelerators XmCAccelerators XtAccelerators dynamic CSG
XmNancestorSensitive XmCSensitive Boolean dynamic G
XmNbackground XmCBackground Pixel dynamic CSG
XmNbackgroundPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNborderColor XmCBorderColor Pixel XtDefaultForeground CSG
XmNborderPixmap XmCPixmap Pixmap XmUNSPECIFIED_PIXMAP CSG
XmNborderWidth XmCBorderWidth Dimension 0 CSG
XmNcolormap XmCColormap Colormap dynamic CG
XmNdepth XmCDepth int dynamic CG
XmNdestroyCallback XmCCallback XtCallbackList NULL C
XmNheight XmCHeight Dimension dynamic CSG
XmNinitialResourcesPersistent XmCInitialResourcesPersistent Boolean True C
XmNmappedWhenManaged XmCMappedWhenManaged Boolean True CSG
XmNscreen XmCScreen Screen * dynamic CG
XmNsensitive XmCSensitive Boolean True CSG
XmNtranslations XmCTranslations XtTranslations dynamic CSG
XmNwidth XmCWidth Dimension dynamic CSG
XmNx XmCPosition Position 0 CSG
XmNy XmCPosition Position 0 CSG

 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |Name                          | Class                         | Type           | Default              | Access |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNaccelerators               | XmCAccelerators               | XtAccelerators | dynamic              | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNancestorSensitive          | XmCSensitive                  | Boolean        | dynamic              | G      |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNbackground                 | XmCBackground                 | Pixel          | dynamic              | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNbackgroundPixmap           | XmCPixmap                     | Pixmap         | XmUNSPECIFIED_PIXMAP | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNborderColor                | XmCBorderColor                | Pixel          | XtDefaultForeground  | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNborderPixmap               | XmCPixmap                     | Pixmap         | XmUNSPECIFIED_PIXMAP | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNborderWidth                | XmCBorderWidth                | Dimension      | 0                    | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNcolormap                   | XmCColormap                   | Colormap       | dynamic              | CG     |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNdepth                      | XmCDepth                      | int            | dynamic              | CG     |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNdestroyCallback            | XmCCallback                   | XtCallbackList | NULL                 | C      |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNheight                     | XmCHeight                     | Dimension      | dynamic              | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNinitialResourcesPersistent | XmCInitialResourcesPersistent | Boolean        | True                 | C      |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNmappedWhenManaged          | XmCMappedWhenManaged          | Boolean        | True                 | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNscreen                     | XmCScreen                     | Screen *       | dynamic              | CG     |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNsensitive                  | XmCSensitive                  | Boolean        | True                 | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNtranslations               | XmCTranslations               | XtTranslations | dynamic              | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNwidth                      | XmCWidth                      | Dimension      | dynamic              | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNx                          | XmCPosition                   | Position       | 0                    | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+
 |XmNy                          | XmCPosition                   | Position       | 0                    | CSG    |
 +------------------------------+-------------------------------+----------------+----------------------+--------+

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 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 that action that invoked the callback will be performed. Setting doit to False negates the action.

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 a structure of type XmTextBlockRec. This structure holds the textual information to be inserted.
   typedef struct
   {
   	char	*ptr;
   	int	length;
   	XmTextFormat	format
   } XmTextBlockRec, *XmTextBlock;

ptr
Is 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.

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 a 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:

Reason Valid fields
XmCR_LOSING_FOCUS reason, event, doit
   
XmCR_MODIFYING_TEXT_VALUE reason, event, doit, currInsert, newInsert, startPos, endPos, text
XmCR_MOVING_INSERT_CURSOR reason, event, doit, currInsert, newInsert

 +--------------------------+------------------------+
 |Reason                    | Valid fields           |
 +--------------------------+------------------------+
 |XmCR_LOSING_FOCUS         | reason, event, doit    |
 +--------------------------+------------------------+
 |XmCR_MODIFYING_TEXT_VALUE | reason, event, doit,   |
 |                          | currInsert, newInsert, |
 |                          | startPos, endPos, text |
 +--------------------------+------------------------+
 |XmCR_MOVING_INSERT_CURSOR | reason, event, doit,   |
 |                          | currInsert, newInsert  |
 +--------------------------+------------------------+

Translations

XmTextField includes translations from XmPrimitive. The XmTextField translations are listed below. These translations may not directly correspond to a translation table. The actions represent the effective behavior of the associated events, and they may differ in a right-to-left language environment.
   BSelect Press:             grab-focus()
   BSelect Motion:            extend-adjust()
   BSelect Release:           extend-end()
   

BExtend Press: extend-start() BExtend Motion: extend-adjust() BExtend Release: extend-end()

BToggle Press: move-destination()

BDrag Press: process-bdrag() BDrag Motion: secondary-adjust() BDrag Release: copy-to()

MCtrl BDrag Press: process-bdrag() MCtrl BDrag Motion: secondary-adjust() MCtrl BDrag Release: copy-to()

MShift BDrag Press: process-bdrag() MShift BDrag Motion: secondary-adjust() MShift BDrag Release: move-to()

MAlt BDrag Press: process-bdrag() MAlt BDrag Motion: secondary-adjust() MAlt BDrag Release: copy-to() MAlt MCtrl BDrag Release: copy-to() MAlt MShift BDrag Release: move-to()

KUp: traverse-prev()

KDown: traverse-next()

KLeft: backward-character() MShift KLeft: key-select(left) MCtrl KLeft: backward-word() MShift MCtrl KLeft: backward-word(extend)

KRight: forward-character() MShift KRight: key-select(right) MCtrl KRight: forward-word() MShift MCtrl KRight: forward-word(extend)

KPageLeft: page-left() KPageRight: page-right()

KBeginLine: beginning-of-line() MShift KBeginLine: beginning-of-line(extend)

KEndLine: end-of-line() MShift KEndLine: end-of-line(extend)

KNextField: next-tab-group() KPrevField: prev-tab-group()

KActivate: activate()

KDelete: delete-next-character() KBackSpace: delete-previous-character()

KAddMode: toggle-add-mode()

KSpace: self-insert() MShift KSpace: self-insert() KSelect: set-anchor() KExtend: key-select() MAny KCancel: process-cancel() KClear: clear-selection() KSelectAll: select-all() KDeselectAll: deselect-all()

KCut: cut-clipboard() KCopy: copy-clipboard() KPaste: paste-clipboard()

KPrimaryCut: cut-primary() KPrimaryCopy: copy-primary() KPrimaryPaste: copy-primary()

KHelp:Help()

KAny: self-insert()

Action routines

The XmText action routines are described below:

activate():
Calls the callbacks for XmNactivateCallback. If the parent is a manager, passes the event to the parent.

backward-character():
Moves the insertion cursor one character to the left. For other effects, see the description of navigation operations in the ``Keyboard selection'' section in XmText(X3mot). This action may have different behavior in a right-to-left language environment.

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. For other effects, see the description of navigation operations in the ``Keyboard selection'' section in XmText(X3mot). 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. For other effects, see the description of shifted navigation operations in the ``Keyboard selection'' section in XmText(X3mot).


beginning-of-line(extend):
If this action is called with no argument, moves the insertion cursor to the beginning of the line. For other effects, see the description of navigation operations in the ``Keyboard selection'' section in XmText(X3mot).

If called with an argument of extend, moves the insertion cursor as in the case of no argument and extends the current selection. For other effects, see the description of shifted navigation operations in the ``Keyboard selection'' section in XmText(X3mot).


clear-selection():
Clears the current selection by replacing each character except <Return> with a <Space> character.

copy-clipboard():
Copies the current selection to the clipboard.

copy-primary():
Copies the primary selection to just before the insertion cursor.

copy-to():
If a secondary selection exists, copies the secondary selection to just before the insertion cursor. If no secondary selection exists, copies the primary selection to the pointer location.

cut-clipboard():
Cuts the current selection to the clipboard.

cut-primary():
Cuts the primary selection to just before the insertion cursor.

delete-next-character():
In normal mode if there is a non-null selection, deletes the selection, otherwise deletes the character following the insertion cursor. In add mode if there is a non-null 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.

delete-next-word():
In normal mode if there is a non-null 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 non-null 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.

delete-previous-character():
In normal mode if there is a non-null selection, deletes the selection, otherwise deletes the character of text immediately preceding the insertion cursor. In add mode if there is a non-null 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.

delete-previous-word():
In normal mode if there is a non-null selection, deletes the selection, otherwise deletes the characters preceding the insertion cursor to the next space, tab or beginning of the line character. In add mode if there is a non-null 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.

delete-selection():
Deletes the current selection.

delete-to-end-of-line():
In normal mode if there is a non-null 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 non-null 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.

delete-to-start-of-line():
In normal mode if there is a non-null 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 non-null 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.

deselect-all():
Deselects the current selection.

end-of-line(extend):
If this action is called with no argument, moves the insertion cursor to the end of the line. For other effects, see the description of navigation operations in the ``Keyboard selection'' section in XmText(X3mot). If called with an argument of extend, moves the insertion cursor as in the case of no argument and extends the current selection. For other effects, see the description of shifted navigation operations in the ``Keyboard selection'' section in XmText(X3mot).

extend-adjust():
Selects text from the anchor to the pointer position and deselects text outside that range.

extend-end():
Moves the insertion cursor to the position of the pointer.

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.

forward-character():
Moves the insertion cursor one character to the right. For other effects, see the description of navigation operations in the ``Keyboard selection'' section in XmText(X3mot). This action may have different behavior in a right-to-left language environment.

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. For other effects, see the description of navigation operations in the ``Keyboard selection'' section in XmText(X3mot). 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. For other effects, see the description of shifted navigation operations in the ``Keyboard selection'' section in XmText(X3mot).


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, three clicks to select a line of text, and four clicks to select all 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.

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(direction):
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. For other effects, see the description of shifted navigation operations and KExtend in the ``Keyboard selection'' section in XmText(X3mot).

move-destination():
Moves the insertion cursor to the pointer position without changing any existing current selection. If there is no current selection, sets the widget as the destination widget.

move-to():
If a secondary selection exists, cuts the secondary selection to just before the insertion cursor. If no secondary selection exists, cuts the primary selection to the pointer location.

next-tab-group():
Traverses to the next tab group.

page-left():
Scrolls the viewing window left one page of text.

page-right():
Scrolls the viewing window right one page of text.

paste-clipboard():
Pastes the contents of the clipboard before the insertion cursor.

prev-tab-group():
Traverses to the previous tab group.

process-bdrag()
The result of this action is determined by several factors: position of the location cursor, movement of the location cursor, and the interval between a BDrag press and release.

This action copies the current selection to the insertion cursor if text is selected, the location cursor is disjoint from the selection, and no motion is detected within a given time interval.

It performs a secondary selection and copies the selection to the position where the text was last edited if the cursor is disjoint from a current selection (if one exists), the time interval is exceeded, and movement of the location cursor is detected.

The action drags the current selection if the location cursor is positioned on the selection, the time interval is exceeded, and movement of the location cursor is detected. This action creates a DragContext object whose XmNexportTargets resource value includes target types of COMPOUND_TEXT, STRING, and TEXT.


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 the parent is a manager, it passes the event to the parent.

secondary-adjust():
Extends the secondary selection to the pointer position.

secondary-start():
Marks the beginning of a secondary selection.

select-all():
Selects all text.

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.

set-anchor():
Resets the anchor point for extended selections. Resets the destination of secondary selection actions.

toggle-add-mode():
Toggles the state of Add Mode.

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.

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 additional behavior described below:

<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. The following table lists the TextField-specific bindings of virtual keys to actual key event descriptions in 1/Motif:

Virtual key bindings

Virtual key Actual key events
KExtend Ctrl Shift<Key>space
  Shift<Key>osfSelect
KSelect Ctrl <Key>space
  <Key>osfSelect

 +------------+--------------------------------+
 |Virtual key | Actual key events              |
 +------------+--------------------------------+
 |KExtend     | Ctrl Shift<Key>space           |
 +------------+--------------------------------+
 |            | Shift<Key>osfSelect            |
 +------------+--------------------------------+
 |KSelect     | Ctrl <Key>space                |
 +------------+--------------------------------+
 |            | <Key>osfSelect                 |
 +------------+--------------------------------+
For information about bindings for virtual buttons and keys, see VirtualBindings(X3mot).

References

Core(X3mot), XmCreateTextField(X3mot), XmFontList(X3mot), XmFontListAppendEntry(X3mot), XmPrimitive(X3mot), XmTextFieldClearSelection(X3mot), XmTextFieldCopy(X3mot), XmTextFieldCut(X3mot), XmTextFieldGetBaseline(X3mot), XmTextFieldGetEditable(X3mot), XmTextFieldGetInsertionPosition(X3mot), XmTextFieldGetLastPosition(X3mot), XmTextFieldGetMaxLength(X3mot), XmTextFieldGetSelection(X3mot), XmTextFieldGetSelectionPosition(X3mot), XmTextFieldGetSelectionWcs(X3mot), XmTextFieldGetString(X3mot), XmTextFieldGetStringWcs(X3mot), XmTextFieldGetSubstring(X3mot), XmTextFieldGetSubstringWcs(X3mot), XmTextFieldInsert(X3mot), XmTextFieldInsertWcs(X3mot), XmTextFieldPaste(X3mot), XmTextFieldPosToXY(X3mot), XmTextFieldRemove(X3mot), XmTextFieldReplace(X3mot), XmTextFieldReplaceWcs(X3mot), XmTextFieldSetAddMode(X3mot), XmTextFieldSetEditable(X3mot), XmTextFieldSetHighlight(X3mot), XmTextFieldSetInsertionPosition(X3mot), XmTextFieldSetMaxLength(X3mot), XmTextFieldSetSelection(X3mot), XmTextFieldSetString(X3mot), XmTextFieldSetStringWcs(X3mot), XmTextFieldShowPosition(X3mot) and XmTextFieldXYToPos(X3mot).
25 April 2004
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004