XmTextField(library call) XmTextField(library call)
NAME [Toc] [Back]
XmTextField - The TextField class
SYNOPSIS [Toc] [Back]
#include <Xm/Xm.h>
DESCRIPTION [Toc] [Back]
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 [Toc] [Back]
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.
- 1 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
As a source of data, TextField supports the following targets and
associated conversions of data to these targets:
locale If the locale target matches the widget's locale, the widget
transfers the selected text in the encoding of the locale.
COMPOUND_TEXT [Toc] [Back]
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:
+ 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, 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
- 2 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
indicate that the widget is no longer the destination.
As a source of data, TextField also supports the following standard
Motif targets:
BACKGROUND [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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, and TEXT.
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
- 3 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
of preference:
1. TEXT
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. COMPOUND_TEXT
2. STRING
Classes [Toc] [Back]
TextField widget inherits behavior, resources, and traits from Core
and Primitive.
The class pointer is xmTextFieldWidgetClass.
The class name is XmTextField.
New Resources [Toc] [Back]
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).
- 4 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
___________________________________________________________________________________________________
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 dynamic CSG
___________________________________________________________________________________________________
XmNdestinationCallback XmCCallback XtCallbackList NULL C
___________________________________________________________________________________________________
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
___________________________________________________________________________________________________
XmNrenderTable XmCRenderTable XmRenderTable dynamic CSG
___________________________________________________________________________________________________
XmNresizeWidth XmCResizeWidth Boolean False CSG
___________________________________________________________________________________________________
XmNselectionArray XmCSelectionArray XtPointer default array CSG
___________________________________________________________________________________________________
XmNselectionArrayCount XmCSelectionArrayCount int 3 CSG
___________________________________________________________________________________________________
XmNselectThreshold XmCSelectThreshold int 5 CSG
- 5 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
___________________________________________________________________________________________________
|XmNvalue XmCValue String "" CSG |
|__________________________________________________________________________________________________|
|XmNvalueChangedCallback | XmCCallback | XtCallbackList | NULL | C |
|___________________________|__________________________|________________|_________________|________|
|XmNvalueWcs | XmCValueWcs | wchar_t * | (wchar_t *)"" | CSG1 |
|___________________________|__________________________|________________|_________________|________|
|XmNverifyBell | XmCVerifyBell | Boolean | dynamic | CSG |
|___________________________|__________________________|________________|_________________|________|
|___________________________|__________________________|________________|_________________|________|
1 This resource cannot be specified in a resource file.
XmNactivateCallback [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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.
- 6 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
XmNdestinationCallback [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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.
- 7 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
XmNlosingFocusCallback [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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.
- 8 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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
- 9 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
fraction of a second.) The possible actions are
XmSELECT_POSITION [Toc] [Back]
Resets the insert cursor position
XmSELECT_WORD [Toc] [Back]
Selects a word
XmSELECT_LINE [Toc] [Back]
Selects a line of text
XmNselectionArrayCount [Toc] [Back]
Specifies the number of actions that are defined in the
XmNselectionArray resource. The value must not be negative.
XmNselectThreshold [Toc] [Back]
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 [Toc] [Back]
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 [Toc] [Back]
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.
- 10 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
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 [Toc] [Back]
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 [Toc] [Back]
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.
- 11 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
____________________________________________________________________________________________________
| XmPrimitive Resource Set |
|Name Class Type Default Access |
|________________________|_______________________|__________________|______________________|________|
|XmNbottomShadowColor | XmCBottomShadowColor | Pixel | dynamic | CSG |
|________________________|_______________________|__________________|______________________|________|
|XmNbottomShadowPixmap | XmCBottomShadowPixmap | Pixmap | XmUNSPECIFIED_PIXMAP | CSG |
|________________________|_______________________|__________________|______________________|________|
|XmNconvertCallback | XmCCallback | XtCallbackList | NULL | C |
|________________________|_______________________|__________________|______________________|________|
|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 |
|________________________|_______________________|__________________|______________________|________|
|XmNlayoutDirection | XmCLayoutDirection | XmDirection | dynamic | CG |
|________________________|_______________________|__________________|______________________|________|
|XmNnavigationType | XmCNavigationType | XmNavigationType | XmTAB_GROUP | CSG |
|________________________|_______________________|__________________|______________________|________|
|XmNpopupHandlerCallback | XmCCallback | XtCallbackList | NULL | C |
|________________________|_______________________|__________________|______________________|________|
|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 |
|________________________|_______________________|__________________|______________________|________|
|________________________|_______________________|__________________|______________________|________|
- 12 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
________________________________________________________________________________________________________________
| 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 |
|______________________________|_______________________________|________________|______________________|________|
|______________________________|_______________________________|________________|______________________|________|
Callback Information [Toc] [Back]
A pointer to the following structure is passed to each callback:
typedef struct
{
int reason;
XEvent * event;
- 13 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
} 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.
- 14 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
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.
- 15 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
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.
_________________________________________________________________
|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, doit, currInsert, newInsert |
|__________________________|_____________________________________|
|__________________________|_____________________________________|
A pointer to the following callback structure is passed to the
XmNdestinationCallback procedures:
- 16 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
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 [Toc] [Back]
The destination widget is not the source of the
data to be transferred.
XmCONVERTING_SAME [Toc] [Back]
The destination widget is the source of the data
to be transferred.
transfer_id
Serves as a unique ID to identify the transfer transaction.
- 17 - Formatted: January 24, 2005
XmTextField(library call) XmTextField(library call)
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_dat
|