|
User Interface Programming: Using Draw Widgets |
|
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.
| Example Code This example is included in the file draw_widget_example.pro in the examples/doc/widgets subdirectory of the IDL distribution. You can either open the file in an IDL editor window (by typing .EDIT draw_widget_example) and compile and run the code using items on the Run menu, or simply enter draw_widget_exampleat the IDL command prompt. See Running the Example Code if IDL does not run the program as expected. |
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.
IDL Online Help (March 06, 2007)