UpPreviousNext

Using Motif Geometry Managers

OSF/Motif contains a number of geometry managers that govern the layout and resize behavior of their children. They range from the straightforward and easy-to-use XmBulletinBoard, to the complex and difficult-to-use XmForm. Builder Xcessory helps you use these managers effectively, from experimenting with different managers, to selecting the appropriate manager, to fine-tuning your final choice of resource settings.

Simple Motif Managers

In general, to use the simple managers described in the following section, you create the manager, create the children, and, depending on the particular manager, move and resize the children directly with the mouse, or set resources on the manager using the Resource Editor.

XmBulletinBoard

The Motif BulletinBoard is the simplest of the Motif managers, and does not control the size or the position of its children. When you use a BulletinBoard with Builder Xcessory, you can take maximum advantage of direct manipulation. Using the mouse, the Layout Grid, and Alignment facilities with the BulletinBoard, what you see is exactly what you get. The flip side of this ease-of-use is that you'll need to manage the x, y, width, and height of all the children in your application code to deal with resize actions from the user. The BulletinBoard is most commonly used when such actions are disallowed, for example, in dialogs.


Hint: Many Builder Xcessory users begin a layout with a BulletinBoard, rather than paper and pencil, to get an initial idea of the screen. They then change the BulletinBoard (by editing the Class Name in the Resource Editor) to a more sophisticated container, such as a Form, and continue work on resize behavior. By changing the class, you maintain the rest of your interface.

XmScrolledWindow

The ScrolledWindow is typically used to provide a viewing area onto a larger widget. Its scrollbars are easily controlled from the Resource Editor.


Hint: It is often easier to create the ScrolledWindow's child before placing it in the ScrolledWindow, because Builder Xcessory does not allow scrolling in Build Mode. To reparent a widget, see Copying and Reparenting Widgets .

XmMainWindow

The MainWindow is frequently used as a top-level window and is designed to manage a MenuBar, a work area with scrollbars, a command area, and a message area. All of these children are optional. The MainWindow manages the size and position of these children, placing the menu bar at the top of the window, stretched to its full width, and placing the message area child at the base of the window, again stretching to its full width. The MainWindow places the command area child above, or below the work area child, and creates and manages the scrollbars on the work area for you.

MenuBars

The MainWindow automatically recognizes and manages the MenuBar. When you create a MenuBar, size does not matter, as a child of a MainWindow, Builder Xcessory automatically manages and sizes it correctly. Add PulldownMenus to the MenuBar and the MenuBar size is again set correctly.

Work, Message, and Command Children

The various MainWindow children are easy to handle with Builder Xcessory. Create the desired objects and place them as children of the MainWindow. Then use the Resource Editor to set resource values on the MainWindow to specify which child belongs in which area. For example, set the value of the workWindow resource to the desired widget instance name by typing the name directly into the field, or using an extended editor to choose the name from a list of the MainWindow children.

VkWindow and VkSimpleWindow

The ViewKit Application Framework supports the notion of a primary, or main window for an application. Specifically, it provides two classes, VkWindow and VkSimpleWindow. The basic element in both of these classes is the XmMainWindow widget, with the VkWindow also including a menu bar with several pre-built menus.

Typically, you never instantiate a VkWindow or VkSimpleWindow directly, rather, you build and use subclasses. If you use a Motif MainWindow directly from the Palette, rather than a ViewKit component, Builder Xcessory automatically detects this when generating ViewKit code and outputs a VkWindow or VkSimpleWindow as appropriate.

XmRowColumn, XmRadioBox, and Menus

The Motif RowColumn manages its children into rows and columns. There are a number of resources, easily accessed through the Builder Xcessory Resource Editor, that control the exact layout.

In addition to the straightforward row-column layout, there are a number of special cases of the RowColumn, (some of which involve additional widgets) including the RadioBox, MenuBar, PulldownMenu, and PopupMenu. Builder Xcessory facilitates using these variations by providing individual Palette icons. Selecting the PulldownMenu Palette icon, for instance, automatically creates a CascadeButton, a RowColumn configured as a PushButton menu item.


Hint: To reorder the items in a RowColumn (any variation, including menus) use the Raise/Lower menu items on the Browser Edit menu or use the MB3 Quick Access menu.

Using Menus

Builder Xcessory helps you work effectively with menus. It automatically creates all of the necessary constituent parts for you, along with an initial PushButton. Then, whenever you have a menu selected, Builder Xcessory posts all of the menu items upon which you are able to perform normal Builder Xcessory functions, including drag and drop. This includes the PopupMenu, which is normally invisible.

You can disable this behavior with the Show Menu Children toggle on the Browser View menu.

Complex Motif Managers

Generally speaking, to use the managers described in the following sections (complex managers), you create the manager, create the children, and use the Resource Editor to set resources on both the manager, and the children . To simplify use of the most complex of these managers, the Form, Builder Xcessory graphically shows the constraints, or attachments, of all Form children and allows you to directly manipulate the attachments with the mouse.


Note: Constraint Resources are always listed after the normal resources in the Resource Editor. If the selected widget is not currently a child of a complex manager, no constraint resources are listed.

XmFrame

The Frame widget manages a WorkArea child and a Label child. The WorkArea child is surrounded by the Frame; the Label child is placed above the WorkArea child. The Frame automatically resizes itself to contain its WorkArea child. You specify which child is the label and which the WorkArea child by means of constraint resources on the children.

XmPanedWindow

The PanedWindow places each of its children into its own vertically tiled region. Constraint resources on its children control their positions and preferred sizes.


Hint: Use the Resource Manager Widget menu to show and hide particular panes in the PanedWindow by managing and unmanaging the Pane's children.

XmForm

The Form widget is probably the most powerful, but most complex Motif manager. It allows you to manage the layout and resize behavior of its children by setting constraint resources on its children. The large number of possible values for these constraints, and the interactions between them, are what make this widget difficult to use.

Builder Xcessory simplifies this for you by graphically depicting these constraints and allowing you to manipulate them directly with the mouse. You can also set them with the Resource Editor and its extended editors.

Setting Form constraint resources

Each child of a Form widget has four constraint resources (attachment, offset, position, widget) for each of its four sides (left, right, top, bottom). These sixteen resources (for example, leftAttachment or bottomPosition) determine how the object behaves when the Form parent is resized.

Builder Xcessory provides attachment handles and the Attachment Editor (see Attachment Editor ) to assist you in setting Form constraint resources, as described in the following sections.

 

Attachment Editor


Hint: Save the interface before using the Attachment Editor. If unexpected changes occur when you make large changes in geometry, select Revert from the Browser Edit menu to reload the last saved version of your interface.

Attachments

An attachment is a resource that binds an edge of an object to either an edge of another object or to a position in the Form.

When working with a Form widget, the order of the creation of its children can affect the resizing properties. For example, when attaching widgets side-to-side, the last widget created resizes when the Form resizes. Use Raise and Lower (from the Browser Edit menu or MB3) to alter the creation order of objects.

Setting and changing attachments

To change the attachment of an object edge, use one of the following methods:

· Click on an attachment handle, drag the attachment to the edge of another child of the form, and release MB1 to set the attachment.

· Hold down MB3 on an attachment handle and choose an attachment from the popup menu. Only attachments for the appropriate edge of the object are displayed.

· Select the object, update the Resource Editor, and set the constraint resources in their respective text fields.

Offsets

A side's offset is the distance maintained between that side and its attachment.

Positions

A side's position is the relative x or y location to which that side is explicitly attached, and is expressed as a ratio with respect to the XmNfractionBase resource.


Note: The position can only be set if attachment is set to XmATTACH_POSITION.

Displaying offsets and positions

To display the constraint resource values for an edge of any Form's child, follow these steps:

1. Hold down Ctrl.

2. Move the cursor over the Form child's attachment icon until the cursor takes the shape of the icon.

3. Hold down MB3.

Any attachment, offset, position and widget values not set to NULL are displayed.

Changing offsets and positions

To change the offset or position of an edge of an object that is the child of a Form, follow these steps:

1. Move the cursor over the object's attachment icon until the cursor takes the shape of the icon.

2. Hold down Ctrl + MB3.

3. Move the cursor to the left or right for a left or right edge, or up or down for a top or bottom edge. The value of the position or offset increments or decrements, depending on the edge being set and the direction the cursor is moved.

EPak Manager Widgets

The EnhancementPak widget set, part of the BX PRO product, provides a number of manager widgets that simplify many geometry management tasks. Virtually all of the EnhancementPak widgets are used in the Builder Xcessory interface.


Note: You can experiment with the EnhancementPak widgets at any time by setting the Start with EPak Widgets toggle on the Behavior tab (Browser:Options: User Preferences), but you must license the libraries to compile and use an application built with them.

See See Palette Objects for more detailed information about EPak widgets.

XiButtonBox

Combines some of the features of RowColumn and Form, evenly distributing its children into a single row or column. ButtonBox knows how to center a child. ButtonBoxes are used throughout Builder Xcessory and are found in most of its dialogs and extended editors.

XiColumn

Combines child objects with optional labels in separate columns, and allows you to specify their relative position.

XiIconBox

Similar to RowColumn, IconBox adds the concept of an absolute cell position.

XiOutline

Manages its children into an indented list form. It is a class sibling of the Tree widget. The various icon groups on the Palette are managed by an Outline widget.


Note: Using the Outline widget for the Palette allows the user to hide a group.

XiPaned

Similar to the Motif PanedWindow, but allows horizontally-tiled panes in addition to vertically-tiled panes. Paned is used in the Browser and Resource Editor to control the layout of those windows.

XiPlotter

A special purpose manager, Plotter manages any number of the various Plot types (Pie Plot, Bar Plot, etc.) included in EnhancementPak.

XiPorthole

Similar to Motif ScrolledWindow, but used in conjunction with the Panner to provide two-dimensional scrolling, a more efficient way to navigate around a viewing region. Porthole is used in the Browser, allowing you to navigate through your instance and class trees.

XiStretch

Similar to Frame, Stretch provides the added functionality of allowing the end-user to resize the Stretch widget and its child with the mouse. Stretch is used in the Builder Xcessory Browser, allowing you to resize the Panner.

XiTabstack

This container is a simple manager with the visual appearance of a stack of manila folders, and allows you to fit multiple interfaces into a limited space. Tabstack is used extensively in Builder Xcessory's preference dialogs and is seen frequently in Microsoft Windows interfaces.

XiToolbar

Similar to Motif RowColumn, Toolbar adds the notion of toolbar groups, the ability for you to group sets of children together, and the Popup Labels feature, similar to Microsoft's WinTips. Toolbars are used in the Browser and the Resource Editor.

XiTree

Manages its children into a tree layout, optionally giving the user the ability to collapse and expand sections of the tree. Tree is used in the Browser Interface hierarchy display area. This is evident in the Browser and several of the Manager windows.

UpPreviousNext