# Toolbar_InstallCallback

int Toolbar_InstallCallback (ToolbarType toolbar, ToolbarCallbackPtr func, void *callbackData);

## Purpose

Specifies a callback function to receive toolbar events as well as the callback data to pass to that function. You can pass NULL for the function parameter to remove an existing callback function.

## Parameters

Input
Name | Type | Description
toolbar | ToolbarType | The specifier for the toolbar to assign the callback to. Obtain this handle from the Toolbar_New or Toolbar_Duplicate functions.
callbackFunc | ToolbarCallbackPtr | The address of the callback function that toolbar events will be sent to. The callback function takes the following form: int ToolbarCallback (ToolbarType toolbar, int event, void *callbackData, int eventData1, int eventData2); The callback function receives the ID of the toolbar generating the event, the type of the event, any additional event data, and the callback data for processing. The toolbar can receive the following events: TOOLBAR_EVENT_DOCK TOOLBAR_EVENT_UNDOCK TOOLBAR_EVENT_SIZE TOOLBAR_EVENT_ARRANGE The TOOLBAR_EVENT_DOCK and TOOLBAR_EVENT_UNDOCK events are swallowable. For these events, eventData1 is the panel the toolbar is being docked to or from and eventData2 is the 0-based index of the row the toolbar will be or is on. The TOOLBAR_EVENT_SIZE occurs when the toolbar is detached and the user sized the toolbar, changing the number of rows. In this case, eventData1 indicates the new number of rows and eventData2 indicates the previous number of rows. TOOLBAR_EVENT_ARRANGE occurs when the user rearranges the toolbars using a kMoveHandle control; its event data parameters are unused.
callbackData | void * | The value passed as the callbackData parameter of the toolbar callback function.

## Return Value

Name | Type | Description
status | integer | Return value indicating whether the function was successful. A negative number indicates that an error occurred.