
316 Chapter 14: Creating a User Interface Panel
Creating a UI Panel Interface iTool Developer’s Guide
|
- Base widget
|
- other widgets
Since the widget ID of the panel widget is supplied as an argument to the panel
creation routine, all that is left is to create a base widget with the panel widget as its
parent, and to populate the base widgets with other widgets as necessary.
Passing State Information
State information can be passed between widget creation routines and widget event
handling routines in several different ways. The method used most often in iTool user
interface panels is to create a state structure in the panel creation routine, store the
appropriate values in this structure, and assign the structure to the widget user value
of one of the widgets in the panel widget hierarchy. For a more detailed discussion of
this technique, see “Managing Application State” (Chapter 2, Widget Application
Programming).
In addition to widget IDs and other state information from your widget interface, you
may find it useful to store object references to the iTool object and to the IDLitUI
object associated with the iTool object in the state structure. Having these object
references available in your event handler and callback routines allows you to take
advantage of methods available in the iTool and user interface objects.
Create Event Handlers
Like other widget applications, iTool user interface panels use one or more event
handling routines to perform actions based on the user’s interaction with the widgets
in the interface. As with generalized widget applications, you can write event
handling routines for a user interface panel in numerous ways; see “Widget Event
Processing” (Chapter 2, Widget Application Programming) for an in-depth discussion
of widget event handling.
The following suggestions apply specifically to event handlers for iTool user
interface panels:
Use the GetSelectedItems Method
Often, you will want to apply an operation to one or more items in the iTool window
when the user selects an element on the user interface panel. Use the
GetSelectedItems method of the iTool object to retrieve references to the iTool
component objects that are selected.