Language > Widgets > About Draw Widgets > Draw Widget Example

# Draw Widget Example

The following example program creates a small widget application consisting of a draw widget and a droplist menu. One of three plots is displayed in the draw widget depending on the selection made from the droplist. To add to dynamic behavior, we will use timer events to change the color table used in the draw window every three seconds.

This example is included in the file `draw_widget_example.pro` in the `examples/doc/widgets` subdirectory of the IDL distribution. Run this example procedure by entering `draw_widget_example` at the IDL command prompt or view the file in an IDL Editor window by entering `.EDIT draw_widget_example.pro`.

This procedure checks the type of event structure returned. See Identifying Widget Type from an Event for more on identifying widget types from returned event structures.

The intent of this example is to demonstrate the use of draw widgets, menus, and timer events with a minimum of other complicating issues. However, it is easy to imagine applications wherein a graphics window containing a plot or some other information is updated periodically by a timer. The method used here can be easily applied to more realistic situations.