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



Pros and Cons of Writing a Motif Widget

Why would you want to write your own Motif widget? After all, Motif Release 2.0 already provides dozens of widgets. Using the standard widget set has some big advantages. The biggest advantage is, of course, that you do not have to do the work. Someone has already gone through the painstaking process of developing the widgets and testing them. The existing Motif widget set is used by thousands of programmers and millions of computer users. This wide use ensures that software defects (bugs) will be ferreted out and reported, and that the standard Motif widgets will grow ever more mature and defect free. Best of all, when a bug is found in one of the Motif widgets, you do not have to fix it.

So, what possible advantage would there be in writing your own widget? Broadly speaking, the biggest advantage is customization. The standard Motif widget set is meant to provide general-purpose solutions. However, general-purpose solutions may not always be sufficient. For example, you may need to write widgets that

  1. Provide flexible table layout

  2. Display complex graphs

  3. Display new kinds of scales, such as circular scales

  4. Generate form layouts that are appropriate for certain applications

    Custom-built widgets can answer different needs. The most obvious need is to provide a widget for a specific application. However, custom-built widgets can also benefit a related group of applications. For example, a geologic consortium could produce a set of widgets that are useful for geologic applications. Doing so would give geologists a more consistent interface across geologic applications and would give geologic programmers a common set of widgets to work from.

    Another advantage of writing your own widgets is that you can easily subclass them. In fact, you can gradually build an entire widget tree to meet your needs.


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