[comp.windows.x] Small HP widget program that doesn't work

jlevy@arisia.Xerox.COM (Jacob Levy) (04/01/89)

Hi,

I grabbed the Xw stuff from ai.toronto.edu and have it up and
running on Sun 3's and 4's. It's great, except that XtGetValues
doesn't seem to do the right thing for these widgets. Here is an
example program and run (on a Sun 3/260, 3.5, with X11R3+purdue2):

Script started on Fri Mar 31 11:33:08 1989
spock:/herbrand/jlevy/xdev <1> cat test.c
#include <stdio.h>

#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/cursorfont.h>
#include <X11/StringDefs.h>

/*
 * Xt Intrinsic includes
 */

#include <X11/IntrinsicP.h>
#include <X11/Intrinsic.h>

/*
 * Inherited stuff from Athena widgets
 */

#include <X11/Label.h>
#include <X11/Shell.h>

/*
 * HP X Widgets includes
 */

#include <Xw/Xw.h>
#include <Xw/PButton.h>

long numargs;
Arg  args[256];

#define StartArgs		numargs = 0
#define MakeArg(n, v){  	args[numargs].name = n; 	\
			        args[numargs].value = (XtArgVal)(v);\
			        numargs++; 			\
		      }

selected(w, a, d)
Widget w;
caddr_t a;
caddr_t d;
{
  long x1, x2, x3, x4, x5;

  StartArgs;
  MakeArg(XtNx, &x1);
  MakeArg(XtNy, &x2);
  MakeArg(XtNwidth, &x3);
  MakeArg(XtNheight, &x4);
  MakeArg(XtNborderWidth, &x5);

  XtGetValues(w, args, numargs);

  printf("widget %d has geometry %dx%d+%dx%dx%d\n", w, x1, x2, x3, x4, x5);

  exit(0);
}

static XtCallbackRec callbackList[] = { {(XtCallbackProc)selected, NULL},
					{NULL, NULL} };

main(ac, av)
char **av;
{
  Widget top;
  Widget p1;

  top = XtInitialize("test", "Test", NULL, NULL, &ac, av);

  StartArgs;
  MakeArg(XtNallowShellResize, True);
  XtSetValues(top, args, numargs);

  StartArgs;
  MakeArg(XtNx, 300);
  MakeArg(XtNy, 300);
  MakeArg(XtNwidth, 300);
  MakeArg(XtNheight, 300);
  MakeArg(XtNselect, callbackList);

  p1 = XtCreateManagedWidget("pbutton", XwpushButtonWidgetClass, top,
			     args, numargs);

  XtRealizeWidget(top);

  XtMainLoop();
}

spock:/herbrand/jlevy/xdev <2> cc -o test test.c -lXw -lXt -lXmu -lX11
spock:/herbrand/jlevy/xdev <3> test
widget 392880 has geometry 0x42392+19670440x19723920x40992
spock:/herbrand/jlevy/xdev <3> 
script done on Fri Mar 31 11:33:25 1989

Does anyone know what's wrong? Has anyone encountered this problem
at all? Do you know where to send bug reports to for Xw widgets?

Any help appreciated.

Thanks, --Jacob