Important: The information in this document is obsolete and should not be used for new development.
MyPanelInstall
A control panel extension must respond to thekPanelInstallSelect
request code. A control panel sends this request code to an extension immediately after sending thekPanelGetDitlSelect
request code (which initially adds your panels's items to the control panel) and just before displaying the panel to the user. A control panel extension typically responds to thekPanelInstallSelect
request code by calling an extension-defined subroutine (for example,MyPanelInstall
) to handle the request.
FUNCTION MyPanelInstall (globals: Handle; dialog: DialogPtr; itemOffset: 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 referenced through this parameter.
itemOffset
- An offset to the panel's first item.
DESCRIPTION
YourMyPanelInstall
function should perform any processing that must occur after the panel is created but before it is displayed to the user. For example, yourMyPanelInstall
function can set or restore default values of various items in the panel. You can also use this opportunity to create user items (such as lists) in the panel.The
itemOffset
parameter specifies the offset from 1 to the first item in your panel. The items installed by your control panel extension are contained in a larger dialog box containing other items; as a result, if you call theGetDialogItem
procedure to obtain a handle to an item, you need to increment theitemNo
parameter passed toGetDialogItem
by the value ofitemOffset
.In most cases, you'll need to save the value passed in the
itemOffset
parameter in your extension's global storage for later use. For example, you usually need this value to determine which panel item the user selected when your extension responds to thekPanelItemSelect
request code.The value passed to your
MyPanelInstall
function in theitemOffset
parameter may be different each timeMyPanelInstall
is called. You should not assume it is always the same value.RESULT CODES
YourMyPanelInstall
function should returnnoErr
if successful, or an appropriate result code otherwise.SEE ALSO
For an example of theMyPanelInstall
function, see Listing 5-4 on page 5-15.