Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

Motif FAQ (Part 5 of 9)
Section - 146) How can I set the color of a XmScale widget's trough?

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Schools ]


Top Document: Motif FAQ (Part 5 of 9)
Previous Document: 145) Can the XmScale widget have arrows or tick marks in Motif 2.0?
Next Document: 147) How does Motif implement mouse button auto-repeat on the
See reader questions & answers on this topic! - Help others by sharing your knowledge
[Last modified: May 95]

Answer: Ken Lee 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 );
        }
    }


User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: Motif FAQ (Part 5 of 9)
Previous Document: 145) Can the XmScale widget have arrows or tick marks in Motif 2.0?
Next Document: 147) How does Motif implement mouse button auto-repeat on the

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
kenton@rahul.net (Ken Lee)





Last Update March 27 2014 @ 02:11 PM