[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Widget Writer's Guide



Buttons to Write and Buttons to Avoid Writing

The standard Motif widget set includes several different kinds of button widgets. Since writing a button widget is not a simple task, you should first determine if one of the standard button widgets already does what you need. For example, if you need a button widget to display interesting visuals, you should consider using the XmDrawnButton widget rather than writing your own widget.

XmPushButton can serve as a DialogBox button widget. However, you may want to write your own DialogBox button widget if you require features not available in XmPushButton. For example, you will need to write your own widget if you want a DialogBox button widget that has a nonrectangular shape. When a button widget becomes the default choice of a DialogBox, the button widget needs to visually alter itself. If you do not like the way that XmPushButton visually alters itself, you can write your own DialogBox button widget.

None of the standard Motif button widgets install the XmQTjoinSide trait. So, if you want a button widget that knows how to visually merge itself with its manager, you are going to have to write your own.

If you do decide to write your own menu button widget, we do not recommend writing it "from scratch." Rather, we strongly recommend that you do it by modifying the ExmMenuButton widget. Note, however, that OSF does not support the ExmMenuButton widget in any way.

Menu button widgets must be managed by a widget holding the XmQTmenuSystem trait. The only standard Motif widget that holds this trait is XmRowColumn. Do not write your own XmQTmenuSystem widget; always use the XmRowColumn widget that comes with the Motif toolkit.

We strongly caution you against writing your own CascadeButton-style widget. If you need a CascadeButton, use the XmCascadeButton widget that comes with the Motif toolkit.


[ Previous | Next | Contents | Glossary | Home | Search ]