Important: The information in this document is obsolete and should not be used for new development.
MyPanelItem
A control panel extension must respond to thekPanelItemSelectrequest code. In general, a control panel sends this request code to your extension whenever the user clicks an item in your panel. A control panel extension typically responds to thekPanelItemSelectrequest code by calling an extension-defined subroutine (for example,MyPanelItem) to handle the request.
FUNCTION MyPanelItem (globals: Handle; dialog: DialogPtr; itemOffset: Integer; itemNum: Integer) : ComponentResult;
globals- A handle to the control panel extension's global data.
dialog- A pointer to the dialog record of the owning control panel. The owning control panel displays your panel's items in the dialog box (of the control panel) referenced through this parameter.
itemOffset- An offset to the panel's first item.
itemNum- The item number of the item selected by the user. This item number is an index into the list of items in the dialog box. To map this value to the item list you passed to the control panel (in the
MyPanelGetDITLfunction), you need to compensate for the offset reported in theitemOffsetparameter.DESCRIPTION
YourMyPanelItemfunction should handle mouse clicks on specific items in your panel. The owning control panel calls your control panel extension with thekPanelItemSelectwhenever your component returnsFALSEin response to an event-select request. YourMyPanelItemfunction is therefore typically invoked each time the user clicks on some item in your panel. Your function should respond appropriately, according to the item that was clicked.As just described, note that when a click in one of your panel's items occurs, the owning control panel first sends your component an event-select request, giving your component a chance to filter the event, if necessary. In this case, if your component returns
FALSEin thehandledparameter, then the control panel sends your component the item-select request code; if your component returnsTRUEin thehandledparameter, the control panel does not send your component the subsequent item-select request code.RESULT CODES
YourMyPanelItemfunction should returnnoErrif successful, or an appropriate result code otherwise.SEE ALSO
For an example of theMyPanelItemfunction, see Listing 5-5 on page 5-16. For information on responding to events, see the description of theMyPanelEventfunction in the next section.