[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

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

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


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


[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 );
        }
    }




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 | Search | Web FAQs | Documents | RFC Index ]

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

Last Update July 24 2008 @ 00:14 AM

© 2008 FAQS.ORG. All rights reserved.