Parent document is top of "Motif FAQ (Part 5 of 9)"
Previous document is "149) Can the XmScale widget have arrows or tick marks in Motif 2.0?"
Next document is "151) How does Motif implement mouse button auto-repeat on the"

150) How can I set the color of a XmScale widget's trough?

[Last modified: May 95]

Answer:  Ken Lee, http://www.rahul.net/kenton/, wrote: There is no direct API
for setting this, but you can set it through resource files with
"*XmScale*troughColor: red".

Ken Sall, ksall@cen.com, adds:  If you need to do this at runtime, you can use
XtGetValues to get the scale's children, find the scrollbar, and set the
XmNtroughColor:

#include <Xm/ScrollBar.h>  // for XmIsScrollBar

        Pixel selectColor; // assume this is set to the desired color
        WidgetList *kids;
        int nkids;
        Arg argList[1], tmpargs[2];
        int i, s, t ;

        i = 0;
        XtSetArg ( argList[i], XmNtroughColor, selectColor ); i++;

        // Unfortunately, scale does not have a direct way
        // to get its scrollbar widget, so use Composite resources
        s = 0;
        XtSetArg (tmpargs[s], XmNnumChildren, &nkids ); s++ ;
        XtSetArg (tmpargs[s], XmNchildren, &kids ); s++ ;
        XtGetValues ( widgetId, tmpargs, s );
        for ( t = 0; t < nkids; t++ )
            {
            if ( XmIsScrollBar ( (Widget) kids[t]) ) // from ScrollBar.h
                {
                XtSetValues ( (Widget) kids[t], argList, i );
                }
            }

Parent document is top of "Motif FAQ (Part 5 of 9)"
Previous document is "149) Can the XmScale widget have arrows or tick marks in Motif 2.0?"
Next document is "151) How does Motif implement mouse button auto-repeat on the"