XbaeInput is a text input field that provides generic customised data entry and formatting for strings.
It does this by using a clever XmNmodifyVerifyCallback that is installed when the XmNpattern resource is
set. The XmNpattern value may include optional characters and literals which will be discussed later in
this document.
The XbaeInput widget is ideal for restricting data input to a digit, alphanumeric character or an
alphabetic character. If XmNconvertCase is set, the widget automatically changes an inserted character
to uppercase or lowercase. Literal characters can also be included in the XmNpattern that can be
automatically inserted as the user types by setting the XmNautofill resource to True. Optional literals
cannot be auto inserted, however.
Unlike the XmText field from which this widget is subclassed, the toggle-overwrite action is bound to the
osfInsert key. The XmNoverwriteMode is also provided to allow the resource to be changed
programmatically.
When the XbaeInput widget loses focus or is activated in the same way as the XmText field would be,
callbacks on the XmNvalidateCallback list are invoked, allowing the programmer to validate the data as
well as reformatting the existing string.
ClassesXbaeInput inherits behavior and resources from the Core, XmPrimitive, and XmText widget classes.
The class pointer is xbaeInputWidgetClass.
The class name is XbaeInput.
NewResources
The following table lists the new resources defined by XbaeInput. The codes in the Access column
indicate whether the given resource can be set at creation time (C), or set by using XtSetValues (S), or
retrieved by using XtGetValues (G).
┌───────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ XbaeInput Resource Set │
├────────────────────────┬──────────────────┬───────────────────┬────────────────────────────┬──────────┤
│ Name │ Class │ Type │ Default │ Access │
├────────────────────────┼──────────────────┼───────────────────┼────────────────────────────┼──────────┤
│ XmNalignment │ XmCAlignment │ unsigned char │ XmALIGNMENT_BEGINNING │ CSG │
├────────────────────────┼──────────────────┼───────────────────┼────────────────────────────┼──────────┤
│ XmNautoFill │ XmCBoolean │ Boolean │ False │ CSG │
├────────────────────────┼──────────────────┼───────────────────┼────────────────────────────┼──────────┤
│ XmNconvertCase │ XmCBoolean │ Boolean │ True │ CSG │
├────────────────────────┼──────────────────┼───────────────────┼────────────────────────────┼──────────┤
│ XmNoverwriteMode │ XmCBoolean │ Boolean │ False │ CSG │
├────────────────────────┼──────────────────┼───────────────────┼────────────────────────────┼──────────┤
│ XmNpattern │ XmCString │ String │ NULL │ CSG │
├────────────────────────┼──────────────────┼───────────────────┼────────────────────────────┼──────────┤
│ XmNvalidateCallback │ XmCCallback │ Callback │ NULL │ CSG │
└────────────────────────┴──────────────────┴───────────────────┴────────────────────────────┴──────────┘
This resource has not been implemented.
XmNalignment
This resource has not been implemented!
Specifies the alignment of the text when being edited and displayed. Possible values are
XmALIGNMENT_BEGINNINGand XmALIGNMENT_END. If XmNalignment is set to XmALIGNMENT_END, the text will
be right justified. If left as the default of XmALIGNMENT_BEGINNING, the text will be left
justified.
XmNautoFill
The XmNautoFill resource, when set to True, attempts to automatically insert a literal if a non
literal is hit in an allowed literal position. For example, if the XmNpattern resource was set up
to accept a date in dd/mm/yyyy format and the user typed "18041999" The resulting string would
appear as "18/04/1999". The default value is False, where the user would have to type the literal.
XmNconvertCase
Tells the XbaeInput widget what should be done to alphabetic characters if the requires a lowercase
or uppercase letter. If the XmNconvertCase is set to True (default), then the character is
automatically converted to the correct case. If set to False, then the user must type the character
in the correct case in order for it to be accepted. See the EXAMPLEPATTERNS section towards the
end of this document for some examples.
overwriteMode
Whether the widget accepts characters in insert mode or overwrite mode is controlled by the
resource. Setting this resource calls the XmTexttoggle-overwrite() action routine, so the Motif
toolkit being used must also support this routine.
XmNpattern
The XmNpattern resource specifies what can be typed into the XbaeInput widget. If set to the
default value of NULL any character may be entered. The XmNpattern can be set to a string
containing the following characters.
a alphabetic characters only
b both - either digit or character
c any character at all
d digits only
U upperchase character only
L lowercase character only
[ start of optional sequence
] end of optional sequence
\\ escapes the next character
| next char is an alternative to previous. May be chained.
InheritedResources
The following table lists the resources which XbaeInput inherits from it's superclasses XmText,
XmPrimitiveandCore. For a complete description of each resource, refer to the man page for that
superclass. The codes in the "Access" column indicate whether the given resource can be set at creation
time (C), or set by using XtSetValues (S), or retrieved by using XtGetValues (G).
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ XmText Resource Set │
├─────────────────────────────┬───────────────────────────┬────────────────┬─────────────────────┬────────┤
│ Name │Class │ Type │ Default │ Access │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNautoShowCursorPosition │XmCAutoShowCursorPosition │ Boolean │ True │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNcursorPosition │XmCCursorPosition │ XmTextPosition │ 0 │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNeditable │XmCEditable │ Boolean │ True │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNeditMode │XmCEditMode │ int │ XmSINGLE_LINE_EDIT │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNfocusCallback │XmCCallback │ XtCallbackList │ NULL │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNgainPrimaryCallback │XmCCallback │ XtCallbackList │ NULL │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNlosePrimaryCallback │XmCCallback │ XtCallbackList │ NULL │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNlosingFocusCallback │XmCCallback │ XtCallbackList │ NULL │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNmarginHeight │XmCMarginHeight │ Dimension │ 5 │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNmarginWidth │XmCMarginWidth │ Dimension │ 5 │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNmaxLength │XmCMaxLength │ int │ largest integer │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNmodifyVerifyCallback │XmCCallback │ XtCallbackList │ NULL │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNmodifyVerifyCallbackWcs │XmCCallback │ XtCallbackList │ NULL │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNmotionVerifyCallback │XmCCallback │ XtCallbackList │ NULL │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNsource │XmCSource │ XmTextSource │ Default source │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNtopCharacter │XmCTextPosition │ XmTextPosition │ 0 │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNvalue │XmCValue │ String │ "" │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNvalueChangedCallback │XmCCallback │ XtCallbackList │ NULL │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNvalueWcs │XmCvalueWcs │ wchar_t * │ (wchar_t *)"" │ CSG │
├─────────────────────────────┼───────────────────────────┼────────────────┼─────────────────────┼────────┤
│ XmNverifyBell │XmCVerifyBell │ Boolean │ dynamic │ CSG │
└─────────────────────────────┴───────────────────────────┴────────────────┴─────────────────────┴────────┘
┌────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ XmPrimitive Resource Set │
├────────────────────────┬─────────────────────────┬───────────────────┬────────────────────────┬────────┤
│ Name │ Class │ Type │ Default │ Access │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNbottomShadowColor │ XmCBottomShadowColor │ Pixel │ dynamic │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNbottomShadowPixmap │ XmCBottomShadowPixmap │ Pixmap │ XmUNSPECIFIED_PIXMAP │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNforeground │ XmCForeground │ Pixel │ dynamic │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNhighlightColor │ XmCHighlightColor │ Pixel │ dynamic │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNhighlightOnEnter │ XmCHighlightOnEnter │ Boolean │ False │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNhighlightPixmap │ XmCHighlightPixmap │ Pixmap │ dynamic │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNhighlightThickness │ XmCHighlightThickness │ Dimension │ 2 │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNnavigationType │ XmCNavigationType │ XmNavigationType │ XmNONE │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNshadowThickness │ XmCShadowThickness │ Dimension │ 2 │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNtopShadowColor │ XmCTopShadowColor │ Pixel │ dynamic │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNtopShadowPixmap │ XmCTopShadowPixmap │ Pixmap │ dynamic │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNtraversalOn │ XmCTraversalOn │ Boolean │ True │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNunitType │ XmCUnitType │ unsignedChar │ dynamic │ CSG │
├────────────────────────┼─────────────────────────┼───────────────────┼────────────────────────┼────────┤
│ XmNuserData │ XmCUserData │ Pointer │ NULL │ CSG │
└────────────────────────┴─────────────────────────┴───────────────────┴────────────────────────┴────────┘
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Core Resource Set │
├───────────────────────────────┬─────────────────────────────┬───────────────┬────────────────────┬───────┤
--