XRT/3d: Interactive 3D Graph Widget
With XRT/field you can build data-entry forms much more quickly and easily than with the standard Motif text widget XmText. XRT/field provides an integrated and comprehensive collection of widgets that supports:
- Automatic validation (using masks, data types, ranges or pick lists)
- Automatic conversion of entered values
- Separate edit and display formats
- Value conversion to an easy-to-use string, date, integer or float
- Automatic scrollbars
- ComboBoxes and SpinBoxes
- Many other features designed to make building data-entry forms easier
XRT/field provides over 60 resources to customize virtually every aspect of how users enter data, from error messages to colors to choosing how negative currency values should be displayed.
Data Type
XRT/field supports 4 basic data types; string (including multiple lines), date and time, integer, float and currency values. XRT/field automatically converts data input by the user into one of these types.
Edit and Display Mask
Masks to control data input and display can be specified. For example, the value "1230" input while editing could be formatted as "$1,230.00".
Validation
XRT/field can automatically validate input data. Validation can depend on many criteria. For example: a range of acceptable values, type, selection list, validation mask, valid/invalid character list, number of lines and line length.
Completion
XRT/field completes partially-input values based on mask, data type and callbacks. For example, if a user inputs "F" in a field which accepts only the name of a month, XRT/field will automatically display "February", or add an extension to a file name in a field where file names are expected.
Conversion
XRT/field can convert input values based on masks or callbacks. For example, it can convert characters input in upper case into lower case.
Conversion
Callbacks can be specified for XRT/field's enter and exit, completion, conversion, validation and error events. Callbacks for menu and spin actions are also provided.
Programming example
Although over 60 resources are provided by XRT/field, it is only necessary to set one or two.
Input field for telephone number, including area code.
phone = XtVaCreateManagedWidget("tel_field", xmXrtStringFieldWidgetClass, parent, XmNxrtFldMask, "(@@) @@@@-@@@@", NULL);
Input field for currency. Negative signs can be used but negative values are displayed in parenthesis. The initial value is specified as 5,500,000.
price = XtVaCreateManagedWidget("currency", xmXrtCurrencyFieldWidgetClass, parent, XmNxrtFldInternalValue, XrtFldDoubleToArgVal(5500000), XmNxrtFldNegativeFormat, XRTFLD_NEG_PARENTHESES, XmNxrtFldDisplayFormat, XRTFLD_FORMAT_CURRENCY, NULL);
Input field to select a value from 1 to 10 by spinning the counter. The initial value is specified as 3.
counter = XtVaCreateManagedWidget("counter", xmXrtSpinBoxWidgetClass, parent, XmNxrtSpinArrowLayout, XRTSPIN_ARROWS_END, XmNxrtSpinArrowOrientation, XmVERTICAL, XmNxrtSpinFieldType, XRTFLD_FIELDTYPE_INT, XmNxrtSpinType, XRTSPIN_TYPE_COUNTER, XmNxrtFldInternalValue, 3, XmNxrtFldMin, 1, XmNxrtFldMax, 10, NULL);
Input field for a date in the format "yyyy/mm/dd"
static String date_format_list[] = {"YYYY/MM/DD", NULL}; date = XtVaCreateManagedWidget("date", xmXrtDateFieldWidgetClass, parent, XmNxrtFldMask, "@@@@/@@/@@", XmNxrtFldEnterFormatList, date_format_list, NULL);
Input field to select an item from a pick list. User input is also allowed.
static String picklist[] = {"Sales Dept.", "Planning Dept.", "Development Dept.", "Accounting Dept.", "General Affairs Dept.", NULL};
greet = XtVaCreateManagedWidget("greeting", xmXrtComboBoxWidgetClass, parent, XmNxrtFldPickList, picklist, XmNxrtFldMatchPickList, False, XmNeditable, True, XmNcursorPositionVisible, True, NULL);