Home Home Company Information Email Japanese

XRT/field FAQ

How do I change the background/foreground color of the picklist?

Retrieve the picklist's widget ID using XmNxrtFldMenuList and then set XmNforeground / XmNbackground to the desired color.

How can I control the appearance of the scrollbar in the field widget?

Since there is no way to alter the size of a scrollBar in a XRT/field widget, you could create a Motif scrolled window with an XRT/field widget as a child of that scrolled window. The scrolled window will control the scrolling for the XRT/field widget. You can also obtain the widget ID of the scrollBars with a XtGetValues() function call. The following program shows how to do this:

#include <Xm/Xm.h>
#include <Xm/Text.h>
#include <Xm/RowColumn.h>
#include <Xm/XrtField.h>
#include <Xm/ScrolledW.h>

main(int argc, char *argv[])
{
    XtAppContext app_context;
    Widget       toplevel, simple, vertbar;
    Widget       temp;
    Widget       sw;
    toplevel = XtVaAppInitialize(&app_context, "Example", NULL, 0,
        &argc, argv, NULL, NULL);

    sw = XtVaCreateManagedWidget("scrolled window",
        xmScrolledWindowWidgetClass,   toplevel,
        XmNscrollingPolicy,            XmAUTOMATIC,
        XmNwidth,                      280,
        XmNheight,                     60,
        NULL);

    XtRealizeWidget(toplevel);
    XtAppMainLoop(app_context);
}

Why isn't YYMMDD working as a FormatString in my datefield?

The year, month and day masks need to be separated. See page 80 of the XRT/field manual for examples.

How can I get the field to accept a blank?

Set XmNxrtFldAllowNull to True.

I just can't get my datefield to accept a blank... why?

Even if XmNxrtFldAllowNull is set to True, a datefield will register an error if you are using a FldMask. That is, if there are format characters such as " / / " or " : ", the field is not NULL. You can override the error by adding the following:

XtAddCallback(field, XmNxrtFldErrorCallback, errorCB, NULL);
...
void errorCB(Widget w, XtPointer client_data, XrtFldErrorCallbackStruct *ecs)
{
  if (strcmp(ecs->text->ptr, "  /  /  :") == 0 )
             ecs->error = XRTFLD_ERROR_NONE;  /* turn the error off */
}