Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!husc6!think!ames!elroy!gryphon!cadovax!trwrb!trwspp!spp2!urban From: urban@spp2.UUCP (Mike Urban) Newsgroups: comp.windows.x Subject: Xaw Viewport Widget: bug? Message-ID: <1467@spp2.UUCP> Date: 11 Oct 88 19:26:19 GMT Article-I.D.: spp2.1467 Sender: news@spp2.UUCP Reply-To: urban@spp2.UUCP (Mike Urban) Organization: TRW Inc., Redondo Beach, CA Lines: 71 The following short toolkit program attempts to put a shallow viewport in a form. It does not work properly in this form; the viewport is sized to the same size as the Box widget that it contains. If the CreateManagedWidget call for the box widget is changed to a CreateWidget, and if ManageChild(box) is performed after RealizeWidget, the behavior is what one would expect. Is this behavior a bug or a feature? Is there some way to get the viewport to maintain its specified size without doing any work after RealizeWidget? Thanks. Mike Urban ...!trwrb!trwspp!spp2!urban "You're in a maze of twisty UUCP connections, all alike" #include #include #include #include #include #include #include #include main (argc, argv) char **argv; { Widget topshell, label, form, viewport, box; Arg arg[10]; int n; topshell = XtInitialize (NULL, "XTest", NULL, 0, &argc, argv); form = XtCreateManagedWidget ("form", formWidgetClass, topshell, NULL, 0); label = XtCreateManagedWidget ("Scrolled? :", labelWidgetClass, form, NULL, 0); n = 0; XtSetArg (arg[n], XtNfromHoriz, label); n++; XtSetArg (arg[n], XtNhorizDistance, 10); n++; XtSetArg (arg[n], XtNheight, 30); n++; XtSetArg (arg[n], XtNwidth, 200); n++; XtSetArg (arg[n], XtNresizable, False); n++; XtSetArg (arg[n], XtNallowVert, True); n++; viewport = XtCreateManagedWidget ("view", viewportWidgetClass, form, arg, n); /* This call must be changed to XtCreateWidget */ box = XtCreateManagedWidget ("box", boxWidgetClass, viewport, NULL, 0); XtSetArg (arg[0], XtNheight, 12); XtSetArg (arg[1], XtNwidth, 200); for (n = 0; n < 10; n++) { char label[10]; sprintf (label, "Label %d", n); (void) XtCreateManagedWidget (label, labelWidgetClass, box, arg, 2); } XtRealizeWidget (topshell); /* XtManageChild(box) is needed here for proper operation */ XtMainLoop(); } Mike Urban ...!trwrb!trwspp!spp2!urban "You're in a maze of twisty UUCP connections, all alike"