[comp.windows.x.motif] Scale widget problems in Motif 1.0

dwight@geohub.enet.dec.com (Dwight D. Moore) (01/03/91)

I am writing a piece of code that uses several scale widgets with range
min...max.
The problem seems to be that I cannot resize this widget  and therefore, I
cannot get scale
the scale to increment by single units (it incre/decre by units of 4 right
now).
........................................................................
.......................................................................
#include <stdio.h>
#include <Xt/Intrinsic.h>
#include <Xt/Shell.h>
#include <Xm/Xm.h>
#include <Xm/MainW.h>
#include <Xm/Form.h>
#include <Xm/Frame.h>
#include <Xm/Label.h>
#include <Xm/PushB.h>
#include <Xm/PushBG.h>
#include <Xm/RowColumn.h>
#include <Xm/Scale.h>

typedef struct cscale_struct {
    int		min;
    int		max;
    char	*title;
    int		width;
    int		height;
    int		decimalpts;
} CScale;

CScale *scaleptr;

CScale rgb_scales[] = {
{0, 255, "Red",   350, SCALE_HEIGHT, 0},
{0, 255, "Green", 350, SCALE_HEIGHT, 0},
{0, 255, "Blue",  350, SCALE_HEIGHT, 0},
};

#define RGB_SCALE_CNT	sizeof (rgb_scales) / sizeof (CScale)
#define MAX_SCALES	3

#define MAX_ARGS	20

Arg XmArgv[MAX_ARGS];			/* Widget arg list 	*/
Cardinal XmArgc;			/* arg list counter 	*/

Widget toplevel;			/* toplevel widget		     */
Widget mainwindow;			/* Main window			     */
Widget mainform;			/* Form dialog widget..a container   */
Widget scaleform;			/* Form dialog widget for scales    */
Widget frame, rc;			/* Frame widget and RowColumn widget */
Widget menubar;				/* Menu bar                          */
Widget filepulldown,			/* Pulldown menu...File control/quit */
	filecascade,
	QuitBtn;
Widget ColorBtns [MAX_COLOR_BTNS];
Widget scales [MAX_SCALES];


Display *dpy;
int screen_num;
Screen screen;

void Create_MainWindow ()
{
  ...
.......
.......
    ** Create another form widget for the scales
    */
    XmArgc = 0;
    XtSetArg (XmArgv[XmArgc], XmNtopAttachment, XmATTACH_WIDGET); XmArgc++;
    XtSetArg (XmArgv[XmArgc], XmNtopWidget, frame); XmArgc++;
    XtSetArg (XmArgv[XmArgc], XmNleftAttachment, XmATTACH_POSITION); XmArgc++;
    XtSetArg (XmArgv[XmArgc], XmNleftPosition, FRAME_LEFT_POSITION); XmArgc++;

    scaleform = XmCreateForm (mainform, "form", XmArgv, XmArgc);
    XtManageChild (scaleform);

   n_scales = RGB_SCALE_CNT;
    scaleptr = (CScale *) itm_scales;

    XtSetArg (XmArgv[XmArgc], XmNshowValue, True); XmArgc++;
    XtSetArg (XmArgv[XmArgc], XmNvalue, 10); XmArgc++;
    XtSetArg (XmArgv[XmArgc], XmNorientation, XmHORIZONTAL); XmArgc++;
    XtSetArg (XmArgv[XmArgc], XmNprocessingDirection, XmMAX_ON_RIGHT);
XmArgc++;
    XtSetArg (XmArgv[XmArgc], XmNtopAttachment, XmATTACH_FORM); XmArgc++;

    for (i=0, tmp=XmArgc;  i < n_scales;  i++, scaleptr++)
    {
        XmArgc = tmp;
	XtSetArg (XmArgv[XmArgc], XmNminimum, scaleptr->min); XmArgc++;
	XtSetArg (XmArgv[XmArgc], XmNmaximum, scaleptr->max); XmArgc++;
	XtSetArg (XmArgv[XmArgc], XmNtitleString, 
	    XmStringCreate (scaleptr->title, XmSTRING_DEFAULT_CHARSET)); 
	    XmArgc++;
	XtSetArg (XmArgv[XmArgc], XmNscaleWidth, scaleptr->width); XmArgc++;
	XtSetArg (XmArgv[XmArgc], XmNwidth, 200);
	XtSetArg (XmArgv[XmArgc], XmNdecimalPoints, scaleptr->decimalpts);
	    XmArgc++;

        if (i == 0)
        {
            XtSetArg (XmArgv[XmArgc], XmNleftAttachment, XmATTACH_FORM);
		XmArgc++;
        }
        else
        {
            XtSetArg (XmArgv[XmArgc], XmNleftAttachment, XmATTACH_WIDGET);
		XmArgc++;
	    XtSetArg (XmArgv[XmArgc], XmNleftWidget, scales[i-1]); XmArgc++;
	    XtSetArg (XmArgv[XmArgc], XmNleftOffset, SCALE_OFFSET); XmArgc++;
        }
	scales[i] = XmCreateScale (scaleform, "cscale", XmArgv, XmArgc);
	XtManageChild (scales[i]);
    }

Any ideas?

------------------------------------------------------------------------
---------
                                Dwight D. Moore
                         Geosciences Computing Network
                            University of Oklahoma

                  dwight@geohub.gcn.uoknor.edu (129.15.40.10)
------------------------------------------------------------------------
---------
Insert your standard disclaimer using a No. 2 pencil or Black/Blue pen:

--------------------------------------------------------------------------------