alanc@coopsol.coopsol.com (Alan Carwile) (05/29/91)
Anyone have a short code fragment using OLIT that builds a Base Window, as described in the Application Style Guidelines? For example, page 68 contains a couple good examples. Unfortunately the OLIT widget set does not contain a widget that creates a base window for you. I want a menubar, a bulletin board with horizontal and vertical scrollbars that operate on AS-NEEDED policy, and a footer area. If I don't get a pointer to a better way, I'll build this as follows: ..Form contains a menu attached at left, right, and top, plus a footer attached at left, right, and bottom. Both menu and footer are attached to each other, with footer widget having varying height, but menu having fixed height. ..Footer then contains a bulletin board, plus a fixed height static text. Samples would be appreciated, as would suggestions to help build this quickly. Are there good code samples generally available somewhere, other than those that match John David Miller's "OPEN LOOK at UNIX" book (got those already)? Thank You, ..AlanC P.S., I'm on OLIT 2.5 if it makes a difference (which it shouldn't, right?) ------------------------------------------------------------------------------ Alan D. Carwile ! domain: alanc@coopsol.com <-- Best choice Cooperative Solutions, Inc. ! uucp: ..!sun!unisoft!coopsol!alanc 2125 Hamilton Ave. Suite 100 ! or ..!hplabs!pyramid!unisoft!coopsol!alanc San Jose, CA. 95125 ! or ..!uunet.uu.net!unisoft!coopsol!alanc (408) 377-0300 x67 phone ! or ..!uu.psi.com!coopsol!alanc (408) 377-7504 fax ! or coopsol!alanc@uu.psi.com ------------------------------------------------------------------------------
openlook-request@openlook (05/30/91)
> Anyone have a short code fragment using OLIT that builds a Base Window, > as described in the Application Style Guidelines? For example, page 68 > contains a couple good examples. Unfortunately the OLIT widget set does > not contain a widget that creates a base window for you. I'm not sure why that is unfortunate...my experience shows that each application has unique needs for a base window, and trying to craft a single widget to handle all cases is likely to be fraught with error. Instead, OLIT (including the Intrinsics) provides several single-purpose widgets that can be combined. OLIT does supply a single widget, PopupWindow, for creating popup (pushpin) windows. I designed it--and I don't use it, because each popup window is different. Anyway, here is a (very abbreviated) code fragment to create the base window at the top of page 68 in the Style Guide. Depending on the details of one's needs this fragment may need to change, but I think it illustrates what can be done. top = OlInitialize(...); base = XtVaCreatePopupShell( "base", transientShellWidgetClass, top, XtNmenuButton, (XtArgVal)True, XtNresizeCorners, (XtArtVal)True, XtNmenuType, (XtArgVal)OL_MENU_FULL, (String)0 ); panel = XtVaCreateManagedWidget( "panel", footerPanelWidgetClass, base, (String)0 ); upper = XtVaCreateManagedWidget( "controls", controlAreaWidgetClass, panel, XtNlayoutType, (XtArgVal)OL_FIXEDCOLS, (String)0 ); footer = XtVaCreateManagedWidget( "footer", staticTextWidgetClass, panel, XtNstring, (XtArgVal)"", (String)0 ); controls = XtVaCreateManagedWidget( "controls", controlAreaWidgetClass, upper, (String)0 ); sw = XtVaCreateManagedWidget( "sw", scrolledWindowWidgetClass, upper, (String)0 ); /* * At this point, "controls" is a layout widget in which to * create the various buttons/menus for the ``Control Area'', * and "sw" is a layout widget that should be given a single * child, probably a TextEdit widget, for the ``Pane''. * "footer" is the widget for the footer area. NOTE: This footer * can only hold a single message, not both a status/error message * and state message. */ Steve Humphrey UNIX System Laboratories
Amy.Moore@Corp.Sun.COM (Amy) (05/31/91)
>>Anyone have a short code fragment using OLIT that builds a Base Window, >>as described in the Application Style Guidelines? For example, page 68 >>contains a couple good examples. Unfortunately the OLIT widget set does >>not contain a widget that creates a base window for you. >> >>I want a menubar, a bulletin board with horizontal and vertical scrollbars >>that operate on AS-NEEDED policy, and a footer area. If I don't get a >>pointer to a better way, I'll build this as follows: Try building the following instance tree: toplevel | footerPanel (this automatically gives the sizing behavior you want) | | Form StaticText (this is the footer message) | ---------------------------- | | ControlArea(menubar) ScrolledWindow (attached to bottom of ControlArea) | | MenuButton1, ... BulletinBoard See code below... Regards, Amy Moore aim@sun.com --------------------------------------------------------------------- #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <Xol/OpenLook.h> #include <Xol/FooterPane.h> #include <Xol/ControlAre.h> #include <Xol/ScrolledWi.h> #include <Xol/MenuButton.h> #include <Xol/BulletinBo.h> #include <Xol/Form.h> #include <Xol/StaticText.h> /*****************************************************************/ main(argc, argv) int argc; char **argv; { Widget toplevel, footerpanel, form, menubar, scrollwin, bb, errortext; toplevel = OlInitialize(argv[0], "Test", NULL, 0, &argc, argv); footerpanel = XtVaCreateManagedWidget("footer", footerPanelWidgetClass, toplevel, NULL); /* * Create Topchild (first child): form */ form = XtVaCreateManagedWidget("topform", formWidgetClass, footerpanel, NULL); /* * Create FooterChild (second child): staticText */ errortext = XtVaCreateManagedWidget("errortext", staticTextWidgetClass, footerpanel, XtNstring, (XtArgVal)"errors:", XtNgravity, (XtArgVal)WestGravity, NULL); /* Here I could add other widgets to the "form"...*/ menubar = XtVaCreateManagedWidget("menubar", controlAreaWidgetClass, form, NULL); /* Here I'd add MenuButtons to menubar...*/ XtVaCreateManagedWidget("File", menuButtonWidgetClass, menubar, NULL); /* Add Scrolled Bulletin Board....*/ scrollwin = XtVaCreateManagedWidget("scrollwin", scrolledWindowWidgetClass, form, XtNyRefWidget, (XtArgVal)menubar, XtNyAddHeight, (XtArgVal)True, XtNxResizable, (XtArgVal)True, XtNyResizable, (XtArgVal)True, XtNyAttachBottom, (XtArgVal)True, XtNxAttachRight, (XtArgVal)True, NULL); bb = XtVaCreateManagedWidget("bulletinboard", bulletinBoardWidgetClass, scrollwin, XtNheight, (XtArgVal)500, XtNwidth, (XtArgVal)500, NULL); XtRealizeWidget(toplevel); XtMainLoop(); } /*******************************END EXAMPLE******************************/