Previous User Interface Programming: Using Draw Widgets Next

Accessing Draw Widget Events

To go beyond merely displaying an image in a draw widget and allow the user to interact in some way with the displayed image, you must configure the draw widget to generate either button, motion, wheel, or keyboard events:

The following example uses motion events to update the values of several label widgets as the mouse cursor moves over an image in a draw widget. This and several other features are discussed in the section following the code.


Example Code
See the file draw_widget_data.pro in the examples/doc/widgets subdirectory of the IDL distribution for the example code. You can either open the file in an IDL editor window and compile and run the code using items on the Run menu, or simply enter

   draw_widget_data

at the IDL command prompt. See Running the Example Code if IDL does not run the program as expected. You may need to enter DEVICE, DECOMPOSED=1 at the IDL command prompt before running this example.

The following things about this example are worth noting:

  IDL Online Help (March 06, 2007)