jaysun@plato.cs.clemson.edu (Jay Williamson - System Manager) (05/24/91)
We are running Motif 1.1.1 and the matching X11R4. In a program
that I am writing, I need to be able to get the width and height
of a widget such as a MainWindow.
Here is an example of the code:
n = 0;
page_parent = XtAppCreateShell ("Page Display", "NSFEditPage",
topLevelShellWidgetClass, dpy, NULL, 0);
XtSetMappedWhenManaged(page_parent, False);
n = 0;
XtSetArg (args[n], XmNx, 5); n++;
XtSetArg (args[n], XmNy, 5); n++;
frame = XmCreateMainWindow (page_parent, "frame", args, n);
XtManageChild (frame);
}
called_routine()
{
. . . . .
ObjWidth(frame);
. . . . .
}
ObjWidth(w)
Widget w;
{
Arg arg[2];
int wid = 0;
int n = 0;
printf ("wid = %d\n", wid);
XtSetArg (arg[n], XmNwidth, &wid); n++;
XtGetValues (w, arg, n);
printf ("wid = %d\n", wid);
return (wid);
}
The program has output like:
wid = 0
wid = 3276800
I tried executing ObjWidth both before and after page_parent had been
realized but with no difference. IS there no way to do this?? Am I
doing something wrong?? Am I going crazy?? All of the above???
Any pointers would be a big help.
Thanks in advance,
Jay Williamson, Systems Manager Clemson University
jaysun@cs.clemson.edu Computer Science Dept.
(803) 656-2639 Clemson, S.C. 29634-1906