XMTEXTFIELD(3)
π XmTextField π
okay bestie, welcome to the library call manual page for XmTextField β she's the TextField class, and she's literally here to make single-line text editing feel iconic. π
β¨ NAME β¨
XmTextField β The TextField class.
π¦ SYNOPSIS π¦
#include <Xm/Xm.h>
π DESCRIPTION π
The TextField widget is a single line text editor for customizing both user and programmatic interfaces. She's used for single-line string entry, and for forms entry with verification procedures. She gives an application a consistent editing system for textual data. Periodt.
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 gives the verification function the widget instance, the event that caused the callback, and a data structure specific to the verification type. From this info, the function can verify if the application considers this a legitimate state change, and can signal the widget whether to continue with the action. No cap.
The user interface tailors a new set of actions. 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. Slay.
π 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 she 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 typeUTF8_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 typeCOMPOUND_TEXT.STRINGβ The widget transfers the selected text as typeSTRING.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 typeCOMPOUND_TEXT.DELETEβ The widget deletes the selected text._MOTIF_CLIPBOARD_TARGETSβ The widget transfers, as typeATOM, 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_STRINGCOMPOUND_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 toSTRING
_MOTIF_EXPORT_TARGETSβ The widget transfers, as typeATOM, a list of the targets to be used as the value of theDragContext'sXmNexportTargetsin a drag-and-drop transfer. These includeCOMPOUND_TEXT, the encoding of the locale,STRING,TEXT,UTF8_STRING,BACKGROUND, andFOREGROUND._MOTIF_LOSE_SELECTIONβ The widget takes the following actions:- When losing the
PRIMARYselection, it unhighlights the selected text and calls theXmNlosePrimaryCallbackprocedures. - When losing the
SECONDARYselection, it removes the secondary selection highlight. - When losing the
_MOTIF_DESTINATIONselection, if the widget does not have focus it changes the cursor to indicate that the widget is no longer the destination.
- When losing the
As a source of data, TextField also supports the following standard Motif targets:
BACKGROUNDβ The widget transfersXmNbackgroundas typePIXEL.CLASSβ The widget finds the first shell in the widget hierarchy that has aWM_CLASSproperty 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 typeWINDOW.COLORMAPβ The widget transfersXmNcolormapas typeCOLORMAP.FOREGROUNDβ The widget transfersXmNforegroundas typePIXEL.NAMEβ The widget finds the first shell in the widget hierarchy that has aWM_NAMEproperty and transfers the contents as text in the current locale.TARGETSβ The widget transfers, as typeATOM, a list of the targets it supports. These include the standard targets in this list. These also includeCOMPOUND_TEXT, the encoding of the locale,STRING,TEXTandUTF8_STRING.TIMESTAMPβ The widget transfers the timestamp used to acquire the selection as typeINTEGER._MOTIF_RENDER_TABLEβ The widget transfersXmNrenderTableif it exists, or else the default text render table, as typeSTRING._MOTIF_ENCODING_REGISTRYβ The widget transfers its encoding registry as typeSTRING. The value is a list ofNULLseparated 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 callingXmRegisterSegmentEncodingandXmMapSegmentEncoding.
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:
TEXTUTF8_STRINGCOMPOUND_TEXT- The encoding of the locale
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:
UTF8_STRINGCOMPOUND_TEXTSTRING
π 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).
β¨ XmTextField Resource Set β¨
okay bestie, here's the whole roster π β every single resource XmTextField has, with its class, its type, its default, and its access code. we are NOT skipping a single one, we're reading the entire list like the dedicated icons we are πβ¨
heads up on that last column:Accessis literally the code the original gives,CorCSG. that's it, that's the data, no editorialising π«Ά
XmNactivateCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCβ the activate callback slot, sitting atNULLuntil you give it a job πXmNblinkRateβ classXmCBlinkRate, typeint, default500, accessCSGβ blink speed, defaulting to a chill500β¨XmNcolumnsβ classXmCColumns, typeshort, defaultdynamic, accessCSGβ the width in columns, and the default isdynamic, which is giving "it decides for itself" πXmNcursorPositionβ classXmCCursorPosition, typeXmTextPosition, default0, accessCSGβ starts at0, the very beginning, main character energy from position zero πXmNcursorPositionVisibleβ classXmCCursorPositionVisible, typeBoolean, defaultdynamic, accessCSGβ whether the cursor shows up, defaultdynamicXmNdestinationCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNeditableβ classXmCEditable, typeBoolean, defaultTrue, accessCSGβ yes bestie, by default you can actually type in it,Truefr fr β¨οΈXmNfocusCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNfontListβ classXmCFontList, typeXmFontList, defaultdynamic, accessCSGβ the font list, defaulting todynamicπ¦XmNgainPrimaryCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNlosePrimaryCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNlosingFocusCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNmarginHeightβ classXmCMarginHeight, typeDimension, default5, accessCSGβ breathing room top and bottom,5units of it πΈXmNmarginWidthβ classXmCMarginWidth, typeDimension, default5, accessCSGβ same deal but sideways, also5XmNmaxLengthβ classXmCMaxLength, typeint, defaultlargest integer, accessCSGβ the character limit, and the default is literallylargest integer, so no cap on the vibes ππ₯XmNmodifyVerifyCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNmodifyVerifyCallbackWcsβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCβ the wide-character sibling, same everything else π§XmNmotionVerifyCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNpendingDeleteβ classXmCPendingDelete, typeBoolean, defaultTrue, accessCSGXmNrenderTableβ classXmCRenderTable, typeXmRenderTable, defaultdynamic, accessCSGXmNresizeWidthβ classXmCResizeWidth, typeBoolean, defaultFalse, accessCSGβFalseby default, so it is NOT out here resizing itself unprompted πXmNselectionArrayβ classXmCSelectionArray, typeXtPointer, defaultdefault array, accessCSGβ default is, and I quote,default arrayβXmNselectionArrayCountβ classXmCSelectionArrayCount, typeint, default3, accessCSGXmNselectThresholdβ classXmCSelectThreshold, typeint, default5, accessCSGXmNvalueβ classXmCValue, typeString, default"", accessCSGβ the actual text content, empty string""until you say otherwise πXmNvalueChangedCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessC
and that's the table, bestie β every name, every class, every type, every default, every access code, accounted for π keep reading, there's more coming π«Άβ¨
XmNvalueWcsβ classXmCValueWcs, typewchar_t *, default(wchar_t *)"", accessCSG^1XmNverifyBellβ classXmCVerifyBell, typeBoolean, defaultdynamic, accessCSG
^1 This resource cannot be specified in a resource file. iykyk.
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β this is the lil choreography list for when you click a bunch of times π. Every mouse click that lands within some time of the previous click bumps the index into this array up by one and runs whatever action lives at that index. (That "multi-click" window is decided by your operating environment, so it's different on different systems β generally it's some fraction of a second, iykyk.) The actions you can slot in are:XmSELECT_POSITIONβ resets the insert cursor position β¨XmSELECT_WORDβ selects a wordXmSELECT_LINEβ selects a line of text
XmNselectionArrayCountβ how many actions are actually defined in theXmNselectionArrayresource. Heads up bestie, this value must not be negative πXmNselectThresholdβ the number of pixels of motion required to select the next character when you're doing selection in click-drag mode. Again, the value must not be negative. This resource is also the one that says whether a drag should be started and how many pixels it takes to start a drag whenBtn2DownandBtn1Downare integrated. multitasking queen πXmNvalueβ the string value of the TextField widget, as achar*data value. It moves the cursor to position 0 unless you explicitly handed over a value ofXmNcursorPositionin the argument list. And ifXmNvalueandXmNvalueWcsare both defined? ThenXmNvalueWcssupersedesXmNvalue, no debate π«Ά.XtGetValuesreturns a copy of the value of the internal buffer, andXtSetValuescopies the string values into the internal buffer.XmNvalueChangedCallbackβ the list of callbacks that fire after text is deleted from or inserted into the TextField. The type of the structure whose address gets passed to this callback isXmAnyCallbackStruct, and the reason sent by the callback isXmCR_VALUE_CHANGED. Important:XmNvalueChangedCallbackshould occur only in pairs with aXmNmodifyVerifyCallbackβ assuming thedoitflag in the callback structure of theXmNmodifyVerifyCallbackis not set toFalse. they're a matched set, fr fr πXmNvalueWcsβ the string value of the TextField widget, but as awchar_t*data value. Like its sibling, it moves the cursor to position 0 unless a value ofXmNcursorPositionwas explicitly supplied in the argument list.
Okay so real talk: this resource cannot be specified in a resource file. Not negotiable. π
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, and XtSetValues copies the value of the wide character string into the internal buffer. wide character queen behavior π
XmNverifyBellβ says whether a bell will sound when an action is reversed during a verification callback. The default here isn't fixed β it depends on the value of the ancestorVendorShell'sXmNaudibleWarningresource. it's giving inherited personality π
πΈ Inherited Resources πΈ
TextField widget inherits behavior and resources from the superclasses in the following tables. For a complete description of these resources, go read the reference page for that superclass β they said what they said π
πΈ the XmPrimitive resource set, bestie πΈ
okay so this is the whole inheritance tea β everything XmPrimitive brings to the table. Every row = one resource, and ima give you the full rundown: the name, its class, the type, the default, and the access. no skips, no cuts, we're doing all of them. π
XmNbottomShadowColorβ classXmCBottomShadowColor, typePixel, defaultdynamic, accessCSGXmNbottomShadowPixmapβ classXmCBottomShadowPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSGXmNconvertCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNforegroundβ classXmCForeground, typePixel, defaultdynamic, accessCSGXmNhelpCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNhighlightColorβ classXmCHighlightColor, typePixel, defaultdynamic, accessCSGXmNhighlightOnEnterβ classXmCHighlightOnEnter, typeBoolean, defaultFalse, accessCSGXmNhighlightPixmapβ classXmCHighlightPixmap, typePixmap, defaultdynamic, accessCSGXmNhighlightThicknessβ classXmCHighlightThickness, typeDimension, default2, accessCSGXmNlayoutDirectionβ classXmCLayoutDirection, typeXmDirection, defaultdynamic, accessCGXmNnavigationTypeβ classXmCNavigationType, typeXmNavigationType, defaultXmTAB_GROUP, accessCSGXmNpopupHandlerCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNshadowThicknessβ classXmCShadowThickness, typeDimension, default2, accessCSGXmNtopShadowColorβ classXmCTopShadowColor, typePixel, defaultdynamic, accessCSGXmNtopShadowPixmapβ classXmCTopShadowPixmap, typePixmap, defaultdynamic, accessCSGXmNtraversalOnβ classXmCTraversalOn, typeBoolean, defaultTrue, accessCSGXmNunitTypeβ classXmCUnitType, typeunsigned char, defaultdynamic, accessCSGXmNuserDataβ classXmCUserData, typeXtPointer, defaultNULL, accessCSG
and that's the whole set, every last one of them, no crumbs left behind π«Ά note how most of them are CSG coded (the classic little trio of access vibes) while the callback ones keep it minimal at just C, and XmNlayoutDirection is the one solo icon rocking CG like the main character it is. π
a bunch of these default to dynamic which basically means the toolkit figures it out for you, and the callback defaults are all sitting pretty at NULL until you wire something up. the two thickness ones β XmNhighlightThickness and XmNshadowThickness β both clock in at 2, cute and consistent. β¨
heads up bestie: this is the XmPrimitive resource set specifically β the classes XmPrimitive gives you β so don't go looking for widget-specific extras here, those live with their own widgets. π
more coming, stay tuned π
π Core Resource Set π
ok so here's the whole menu of core resources, bestie β name, class, type, default, and access, all of it, no skips:
XmNacceleratorsβ classXmCAccelerators, typeXtAccelerators, defaultdynamic, accessCSGXmNancestorSensitiveβ classXmCSensitive, typeBoolean, defaultdynamic, accessGXmNbackgroundβ classXmCBackground, typePixel, defaultdynamic, accessCSGXmNbackgroundPixmapβ classXmCPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSGXmNborderColorβ classXmCBorderColor, typePixel, defaultXtDefaultForeground, accessCSGXmNborderPixmapβ classXmCPixmap, typePixmap, defaultXmUNSPECIFIED_PIXMAP, accessCSGXmNborderWidthβ classXmCBorderWidth, typeDimension, default0, accessCSGXmNcolormapβ classXmCColormap, typeColormap, defaultdynamic, accessCGXmNdepthβ classXmCDepth, typeint, defaultdynamic, accessCGXmNdestroyCallbackβ classXmCCallback, typeXtCallbackList, defaultNULL, accessCXmNheightβ classXmCHeight, typeDimension, defaultdynamic, accessCSGXmNinitialResourcesPersistentβ classXmCInitialResourcesPersistent, typeBoolean, defaultTrue, accessCXmNmappedWhenManagedβ classXmCMappedWhenManaged, typeBoolean, defaultTrue, accessCSGXmNscreenβ classXmCScreen, typeScreen *, defaultdynamic, accessCGXmNsensitiveβ classXmCSensitive, typeBoolean, defaultTrue, accessCSGXmNtranslationsβ classXmCTranslations, typeXtTranslations, defaultdynamic, accessCSGXmNwidthβ classXmCWidth, typeDimension, defaultdynamic, accessCSGXmNxβ classXmCPosition, typePosition, default0, accessCSGXmNyβ classXmCPosition, typePosition, default0, accessCSG
πΈ Callback Information πΈ
ok so every single callback gets handed a pointer to this little guy right here:
typedef struct
{
int reason;
XEvent * event;
} XmAnyCallbackStruct;
reasonβ spills the tea on why the callback got invoked πeventβ points at theXEventthat triggered the callback
ngl this next bit is important, so lock in π
The TextField widget defines a brand new callback structure for use with verification callbacks. And heads up β not all of the fields are relevant for every callback reason. So the app has to peek at the reason field first, and then only touch the structure members that are actually valid for that particular reason. Periodt.
The values startPos, endPos, and text inside the callback structure XmTextVerifyCallbackStruct can be modified when you receive the callback, and those changes will be reflected as the change made to the source of the TextField widget. (Like, for example, all keystrokes can be converted to spaces or NULL characters when a password is entered into a TextField widget. iconic behaviour honestly π₯) The application programmer should not overwrite the text field β instead, attach data to that pointer. got it? π«Ά
A pointer to the following structure is passed to the callbacks for XmNlosingFocusCallback, XmNmodifyVerifyCallback, and XmNmotionVerifyCallback.
okay so here's the struct itself, the one that shows up at your verify callbacks, in all its β¨gloryβ¨:
typedef struct
{
int reason;
XEvent *event;
Boolean doit;
XmTextPosition currInsert, newInsert;
XmTextPosition startPos, endPos;
XmTextBlock text;
} XmTextVerifyCallbackStruct, *XmTextVerifyPtr;
And here's the field-by-field breakdown, because every one of these matters:
reasonβ why the callback got invoked. That's the whole job.eventβ points to theXEventthat triggered the callback. It can beNULL. For example, when the Text widget gets changed programmatically there's literally no event to hand over to the associated callback, so it's just vibing asNULL.doitβ tells you whether the action that invoked the callback is actually gonna happen. SetdoittoFalseand you negate the action. π But bestie, listen: not every action can be negated. For example,XmCR_LOSING_FOCUScallbacks may be completely beyond the widget's control if they come from mouse clicks. Not everything is yours to cancel, sorry.currInsertβ where the insert cursor is sitting right now.newInsertβ where the user is trying to put the insert cursor.startPosβ the starting position of the text to modify. If the callback isn't a modify verification callback, this value equalscurrInsert.endPosβ the ending position of the text to modify. If nothing gets replaced or deleted, it equalsstartPos. And again, if the callback isn't a modify verification callback, this equalscurrInsert.textβ points to the following structure of typeXmTextBlockRec. This structure holds the textual information that's about to be inserted.
typedef struct
{
char *ptr;
int length;
XmTextFormat format
} XmTextBlockRec, *XmTextBlock;
ptrβ the text to be inserted. Heads up:ptrpoints to temporary storage space that gets reused once the callback finishes. So if your application needs to keep that text around, it has to copy it into its own data space. No borrowing, bestie. πlengthβ how long the text to be inserted is.formatβ the format of the text, eitherXmFMT_8_BITorXmFMT_16_BIT.
(and yes, there is no semicolon after format up there β that's exactly how it's written, don't come for me π«Ά)
A pointer to the following structure is what gets passed to callbacks for XmNmodifyVerifyCallbackWcs.
typedef struct
{
int reason;
XEvent *event;
Boolean doit;
XmTextPosition currInsert, newInsert;
XmTextPosition startPos, endPos;
XmWcsTextBlock text;
} XmTextVerifyCallbackStructWcs, *XmTextVerifyPtrWcs;
reasonβ why the callback got invoked.eventβ points to theXEventthat triggered the callback. It can beNULL. For example, changes made to the Text widget programmatically don't have an event that can be passed to the associated callback.doitβ whether the action that invoked the callback gets performed. SettingdoittoFalsenegates the action. And again, not all actions may be negated. For example,XmCR_LOSING_FOCUScallbacks may be beyond the control of the widget if they're produced by mouse clicks.currInsertβ the current position of the insert cursor.newInsertβ the position at which the user attempts to position the insert cursor.startPosβ the starting position of the text to modify. If the callback is not a modify verification callback, this value is the same ascurrInsert.endPosβ the ending position of the text to modify. If no text is replaced or deleted, the value is the same asstartPos. If the callback is not a modify verification callback, this value is the same ascurrInsert.textβ points to the following structure of typeXmTextBlockRecWcs. 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β the number of characters to be inserted.
So which fields are even valid depends entirely on the reason. Here's the full vibe check, and remember: the event field will never be valid for XmCR_MOVING_INSERT_CURSOR. Never ever. π
XmCR_LOSING_FOCUSβ valid fields:reason,event,doitXmCR_MODIFYING_TEXT_VALUEβ valid fields:reason,event,doit,currInsert,newInsert,startPos,endPos,textXmCR_MOVING_INSERT_CURSORβ valid fields:reason,doit,currInsert,newInsert
A pointer to the following callback structure is what gets 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β why the callback got invoked.eventβ points to theXEventthat triggered the callback. It can beNULL.selectionβ the selection for which data transfer is being requested. Possible values areCLIPBOARD,PRIMARY,SECONDARY, and_MOTIF_DROP.operationβ the type of transfer operation requested. And it depends on the selection, so buckle up:- When the selection is
PRIMARYorSECONDARY, possible values areXmMOVE,XmCOPY, andXmLINK. - When the selection is
CLIPBOARD, possible values areXmCOPYandXmLINK. - When the selection is
_MOTIF_DROP, possible values areXmMOVE,XmCOPY,XmLINK, andXmOTHER. A value ofXmOTHERmeans the callback procedure must go get further information from theXmDropProcCallbackStructin thedestination_datamember.
- When the selection is
flagsβ whether or not the destination widget is also the source of the data being transferred. 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. It's the receipt, basically. π§Ύdestination_dataβ contains information about the destination. When the selection is_MOTIF_DROP, the callback procedures are called by the drop site'sXmNdropProc, anddestination_datais a pointer to theXmDropProcCallbackStructpassed to theXmNdropProcprocedure. When the selection isSECONDARY,destination_datais anAtomrepresenting a target recommmended by the selection owner for use in converting the selection. Otherwise,destination_dataisNULL.location_dataβ contains information about the location where data is to be transferred. The value is alwaysNULLwhen the selection isCLIPBOARD. If the value isNULL, the data is to be inserted at the widget's cursor position. Otherwise, the value is a pointer to anXPointstructure containing the x and y coordinates at the location where the data is to be transferred. π¨ And onceXmTransferDoneprocedures start to be called,location_datawill no longer be stable. Do not hold onto it.timeβ the time when the transfer operation began. β°
β¨ Translations β¨
The XmTextField translations are described in the list below. 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 Motif uses to specify the widget actions corresponding to a given key. There's a brief overview of the format over in 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()
okay so plot twist time π the TextField button event translations get modified when Display's XmNenableBtn1Transfer resource does not have a value of XmOFF β in other words, when it's either XmBUTTON2_TRANSFER or XmBUTTON2_ADJUST. This option is the whole reason selection and transfer can be integrated on <Btn1>, which is giving "one button to rule them all" ngl. π
And bestie, the <Btn1> actions defined above still apply whenever the <Btn1> event happens over text that is not selected. The following actions apply when the <Btn1> event happens 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().
And when Display's XmNenableBtn1Transfer resource has a value of XmBUTTON2_ADJUST, these are the ones that apply:
<Btn2Down>:
extend-start().
<Btn2Motion>:
extend-adjust().
<Btn2Up>: extend-end().
β¨ Action Routines β¨
The XmTextField action routines are... okay buckle up, here's the whole roster π«Ά
π activate()
Calls the callbacks for XmNactivateCallback. And if the parent is a manager, it passes the event to the parent. That's the whole job description, no notes.
π backward-character(extend)
Moves the insertion cursor one character to the left. Heads up though β this action may have different behavior in a right-to-left language environment. π
If you call it with an argument of extend, it moves the insertion cursor just like the no-argument case and extends the current selection.
The backward-character() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. If it's called with the extend argument, the backward-character() action may produce calls to the XmNgainPrimaryCallback procedures. Peep the callback description for the full tea. π
π backward-word(extend)
Call it with no argument and it 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, it moves the insertion cursor to the beginning of the previous word. Also, heads up: this action may have different behavior in a locale other than the C locale. π
If you call it with an argument of extend, it moves the insertion cursor just like the no-argument case and extends the current selection.
The backward-word() action produces calls to the XmNmotionVerifyCallback procedures with reason value XmCR_MOVING_INSERT_CURSOR. If it's called with the extend argument, the backward-word() action may produce calls to the XmNgainPrimaryCallback procedures. See the callback description for more info. π§
π beginning-of-line(extend)
With no argument? It moves the insertion cursor to the beginning of the line. Periodt. β¨
With an argument of extend? It moves the insertion cursor just like the no-argument case and extends the current selection.
The beginning-of-line() action produces calls to the XmNmotionVerifyCallback with reason value XmCR_MOVING_INSERT_CURSOR. If it's called with the extend argument, the beginning-of-line() action may produce calls to the XmNgainPrimaryCallback procedures. See the callback description for more. π
π clear-selection()
Clears the current selection by replacing each character β except <Return> β with a <space> character. So like, every char gets swapped for a space, and <Return> stays exactly where it is, iconic behavior honestly. π
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. It 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 also calls the selection owner's XmNconvertCallback procedures β possibly multiple times β for the PRIMARY selection.
On top of all that, 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 the 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. And if the primary selection is in the destination widget, it gets deselected. Otherwise? No effect at all on the primary selection, she's unbothered. π
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 instead. 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.
And 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 the callback description for more information. π¦
π cut-clipboard()
If this widget owns the primary selection, this action cuts the selection to the clipboard. It calls the XmNconvertCallback procedures β possibly multiple times β for the CLIPBOARD selection. And if the transfer is successful? Then it calls the XmNconvertCallback procedures for the CLIPBOARD selection and the DELETE target. two for one, we love to see it π
On top of that, 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() βοΈπ
okay bestie, this one is the cut-and-paste main character. It cuts the PRIMARY selection and pastes it just before the insertion cursor. It calls the XmNdestinationCallback procedures for the PRIMARY selection and the XmMOVE operation. It also 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() ποΈβ¨
normal mode vs add mode, bestie. Here's the tea:
- 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
XmNpendingDeleteis set toTrue, 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() ποΈπ
same normal/add mode energy, but word edition:
- 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
XmNpendingDeleteis set toTrue, 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() ποΈβ¬
οΈ
normal/add mode again:
- 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
XmNpendingDeleteis set toTrue, 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
XmNpendingDeleteis set toTrue, 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. That's it, that's the vibe.
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
XmNpendingDeleteis set toTrue, 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
XmNpendingDeleteis set toTrue, 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. No callbacks, no drama.
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()
okay so this key binding performs the action defined in XmNselectionArray, and which action depends on the number of multiple mouse clicks. the default selection array ordering is: one click β moves the insertion cursor to the pointer position, two clicks β selects a word, and three clicks β selects a line of text. a single click also deselects any selected text and sets the anchor at the pointer position. also, heads up bestie, 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. and if this widget has, like, no help callbacks? it goes and calls the help callbacks for the nearest ancestor that has them. found family energy fr. π«Ά
key-select(right|left)
- call it with an argument of
rightβ moves the insertion cursor one character to the right and extends the current selection. - call it with an argument of
leftβ moves the insertion cursor one character to the left and extends the current selection. - call it with no argument β extends the current selection.
note bestie: 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. but plot twist β the TextField widget itself performs no transfers. the XmNdestinationCallback procedures are the ones 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.
and again, 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, it sets the widget as the destination widget. it 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 β like, do not do this. π 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. so chill.
page-right()
scrolls the viewing window right one page of text.
the page-right() action produces no callbacks either. balanced, as all things should be. β¨
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. very "never mind, forget I said anything" of it. π
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. then 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. also 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. and in overstrike mode, when the end of a line is reached, characters are appended to the end of the line. no cap. π
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, bestie:
<FocusIn>β draws the insertion cursor as solid and starts blinking the cursor. main character energy, honestly. β¨<FocusOut>β draws the insertion cursor as a stippled I-beamβ¦ unless it's the destination widget, in which case bestie, it just sits there looking normal π
π¦ Virtual Bindings π¦
The tea on virtual key bindings? They're <strong>vendor specific</strong> β every vendor does their own thing, no universal rules, iykyk. So if you wanna know about the bindings for virtual buttons and keys, go read VirtualBindings(3). That's the one that actually spills. β¨
π RELATED π
okay so here's the whole friend group π every single one of these is canon and you should absolutely go meet them:
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)XmVaCreateManagedTextField(3)
and that's the whole page, bestie, we made it to the end πβ¨ the very last line down there is the footer, and it's giving <pink>XmTextField(library call)</pink> β so that's your source/version and date vibes, all official, all iconic, no cap. go forth and text-field responsibly ππ
π¦
π¦ where this page comes from
- arch rolling: openmotif 2.3.8-4 Β· LGPL-2.1-or-later
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- centos-stream 9: motif-devel 2.3.4-32.el9 Β· LGPLv2+
- epel 10: motif-devel 2.3.8-2.el10_2 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-1.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 43: motif-devel 2.3.8-2.fc43 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- fedora 44: motif-devel 2.3.8-3.fc44 Β· LicenseRef-Callaway-LGPLv2+
- nixos 26.05: motif 2.3.8
- nixpkgs unstable: motif 2.3.8
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: motif-devel 2.3.8-bp160.1.1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms