sm@GATOR.CACS.USL.EDU (Srinivas Madhur) (03/21/90)
When I create a form widget as a child of viewport, and set the size of viewport (either thro' xrdb or hardcoded), the children of the form are no longer having their default sizes. For example, if the children of the form are label and command, their size if anything other than the default size of the smallest box enclosing the default label; this does not happen if the child of viewport is a box. I think this is in R4 only. Am I doing something silly? Is this a bug already known? I am enclosing a sample program which illustrates the problem. Any comments would be appreciated. Thanks, Srinivas -- Srinivas Madhur sm@gator.cacs.usl.edu sm@cacs.usl.edu ..!dalsqnt!gator!sm -------------------------cut here--------------------------------- #include <stdio.h> #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Xaw/Form.h> #include <X11/Xaw/Label.h> #include <X11/Xaw/Command.h> #include <X11/Xaw/Viewport.h> #include <X11/Xaw/Cardinals.h> void CreateSomeButtons(); main(argc, argv) int argc; char **argv; { /* * SETTING THE WIDTH AND HEIGHT OF VIEWPORT CHANGES THE * DEFAULT SIZES OF ITS GRANDCHILDREN WHEN ITS CHILD IS A * FORM WIDGET. THIS IS NOT THE CASE IF THE CHILD IS A BOX. */ Widget toplevel, viewport; Arg arg[10]; int i = 0; toplevel = XtInitialize("xbug", "Xbug", NULL, ZERO, &argc, argv); XtSetArg(arg[i], XtNwidth, 500), i++; XtSetArg(arg[i], XtNheight, 500), i++; viewport = XtCreateManagedWidget( "viewport", viewportWidgetClass, toplevel, arg, i); CreateSomeButtons(viewport); XtRealizeWidget(toplevel); XtMainLoop(); } /* Function Name: CreateSomeButtons * Description: Creates a form widget with 2 children: * a label and a command. */ void CreateSomeButtons(parent) Widget parent; { Widget form, label, quit; Widget button1, button2, button3; int i = 0; Arg args[5]; extern XtCallbackProc getout(); form = XtCreateManagedWidget( "form", formWidgetClass, parent, NULL, ZERO); label = XtCreateManagedWidget("label", labelWidgetClass, form, NULL, ZERO); i = 0; XtSetArg(args[i], XtNfromVert, label); i++; quit = XtCreateManagedWidget("Quit", commandWidgetClass, form, args, i); XtAddCallback(quit, XtNcallback, getout, NULL); } XtCallbackProc getout(w, dummy1, dummy2) Widget w; XtPointer dummy1, dummy2; { exit(0); } ----------------------cut here-----------------------------------