[comp.windows.x.motif] XmScale Widget...help

gdurf@smoke.brl.mil (Glenn Durfee (SWS|durf) <gdurf>) (07/25/90)

Hello NetLand,

How can you adjust a scale's length using OSF/Motif?
I have tried setting several args before sending them to the the XCreateWidget
function (it is necessary to set the length of the scale from within the
program, not in a resource file.)

I have tried setting the XmNwidth (I am using a horizontally-oriented scale)
and the XmNscaleWidth, but neither seem to work.  XmNscaleHeight adjusts the
thickness of the slider in the scale.

The following piece of code displays a rather tall slider with about 100
pixels horizontally in which to move (the default?).  It should, I think,
show a roughly square scale, 300 x 300. It seems to me that XmNscaleWidth
should give the slider more room.

BTW, what do XmNwidth and XmNheight do for scale Widgets?  (As opposed to
XmNscaleWidth and XmNscaleHeight)

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
#include <Xm/Scale.h>

int main(argc, argv)
int	argc;
char  **argv;
{
	Widget top, foo;
	Arg args[20];
	int n;

	top = XtInitialize(argv[0], "Scale", NULL, 0, &argc, argv);
	
	n = 0;
	XtSetArg(args[n], XmNorientation, XmHORIZONTAL); n++;
	XtSetArg(args[n], XmNprocessingDirection, XmMAX_ON_RIGHT); n++;
	XtSetArg(args[n], XmNminimum, 0); n++;
	XtSetArg(args[n], XmNmaximum, 500); n++;
	XtSetArg(args[n], XmNscaleHeight, 300); n++;
	XtSetArg(args[n], XmNscaleWidth, 300); n++;
	XtSetArg(args[n], XtNheight, 400); n++;
	XtSetArg(args[n], XtNwidth, 400); n++;
	XtSetArg(args[n], XmNshowValue, 1); n++;

	foo = XtCreateManagedWidget("sliding_slider_scale",
			xmScaleWidgetClass, top, args, n);

	XtRealizeWidget(top);
	XtMainLoop();

	return (0);
}


Am I missing something painfully obvious, or is something broken?

Please email.

Glenn Durfee   |   gdurf@smoke.brl.mil   |   gdurf@192.5.23.2