Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!emory!gatech!hubcap!news From: jaysun@plato.cs.clemson.edu (Jay Williamson - System Manager) Newsgroups: comp.windows.x.motif Subject: How to get size of widget like MainWindow, etc. Message-ID: <1991May24.034033.10485@hubcap.clemson.edu> Date: 24 May 91 03:40:33 GMT Sender: news@hubcap.clemson.edu (news) Organization: Clemson University Computer Science Dept. Lines: 55 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