|
User Interface Programming: Using Tab Widgets |
|
The following example builds on Example: A Simple Tab Widget by adding the following features:
| Example Code This example is included in the file tab_widget_example2.pro in the examples/doc/widgets subdirectory of the IDL distribution. 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 tab_widget_example2at the IDL command prompt. See Running the Example Code if IDL does not run the program as expected. |
The following things about this example are worth noting:
retStruct structure is an example of the kind of information you might pass out of a tab widget, back to a larger widget application. Using an approach like the one here allows the user to set a group of values before sending any of them to the larger application. This may be more efficient than updating the larger application "on the fly" as the user makes changes to the widgets in the tab interface.
TWE2_saveValue refers to the fields of the retStruct structure by their indices instead. We do this because while it is not possible to pass the field name in a variable, it is possible to pass the integer index value. Passing the index value of the appropriate field in the retStruct structure as the user value of the widget whose value is being saved allows us to write a single TWE2_saveValue function, rather than one function for each field in the retStruct structure.
IDL Online Help (March 06, 2007)