# EasyTab_Create

int EasyTab_Create (int panel, int top, int left, CtrlCallbackPtr callbackFunction, void *callbackData);

## Purpose

This function creates a new Tab control.

A Tab control allows you to display overlapping child panels. The user can select which child panel to view by clicking on a tab attached to the panel. The result is a file-folder-like user interface.
Features:

- Tabs can be stacked in multiple rows.
- Tabs can be on top, bottom, left, or right edge of panel area.
- Tabs can be stretched to fit the available space, separated by equal-sized gaps, or arranged with the all the extra space after the last tab.
- A panel in a tab control can, in turn, contain another tab control.
- You can add existing panels to a tab control, or load panels from a .uir file directly into a tab control.
- By default, the tab control automatically sizes itself to accommodate its largest panels and the space required for the tabs.
- The tab control ensures that all of its panels are the same size.
- Underline key accelerators can be used in tab names.

Events:

> When you change tabs, the event EVENT_TAB_CHANGED is sent to the Tab Control's callback and the callbacks for the panels associated with the current and previous active tabs. The callbacks are called with eventData1 set to the panel handle associated with the current active tab and with eventData2 set to the panelHandle associated with the previous active tab (or to 0 if no tab was previously active).

| Note The Easy Tab Instrument uses the toolbox function ChainCtrlCallback on the tab control, its child panels and their controls, and the panel that the EasyTab control is on (and all of its controls). If you change the callback function or callback data of one of these controls or panels, the resulting behavior is undefined. However, you may call ChainCtrlCallback. You may also set the callback function and callback data for a canvas control before converting it to a tab control, and you may also specify a callback function and callback data when calling EasyTab_Create. For the same reasons, do not call DuplicatePanel or DuplicateCtrl on any of these panels or controls after the Easy Tab control has been created. DiscardPanel or DiscardCtrl will free dynamically allocated memory used by a Tab control.

## Parameters

Input
Name | Type | Description
panel | integer | The specifier for a particular panel that is currently in memory. This handle will have been returned by the LoadPanel, NewPanel, or DuplicatePanel function.
top | integer | The vertical panel coordinate at which the upper left corner of panel area of the Tab control is placed.
| Note Tabs are drawn attached to the edge of the panel area. The edge on which the tabs are located can be changed by setting the ATTR_EASY_TAB_ORIENTATION attribute.
The coordinate must be an integer value from -32768 to 32767. The origin (0,0) is at the upper-left corner of the panel (directly below the title bar) before the panel is scrolled.
left | integer | The horizontal panel coordinate at which the upper left corner of panel area of the Tab control is placed.
| Note Tabs are drawn attached to the edge of the panel area. The edge on which the tabs are located can be changed by setting the ATTR_EASY_TAB_ORIENTATION attribute.
The coordinate must be an integer value from -32768 to 32767. The origin (0,0) is at the upper-left corner of the panel (directly below the title bar) before the panel is scrolled.
callbackFunction | CtrlCallbackPtr | The name of the user-defined function that processes events for the control. Pass 0 if this functionality is not needed. This event function (type CtrlCallbackPtr) takes the form: int CVICALLBACK EventFunctionName (int panelHandle, int controlID, int event, void *callbackData, int eventData1, int eventData2); The callback function receives an EVENT_TAB_CHANGED each time the Tab control changes the panel it displays.
callbackData | void * | A pointer to user-defined data passed to the event function. Pass 0 if you do not need this functionality.

## Return Value

Name | Type | Description
newEasyTabControl | integer | Returns the ID used to specify the tab control in subsequent function calls. Negative values indicate that an error occurred. The possible negative error codes are:
–1 to –999 | A User Interface Library error code. (Constants are available in userint.h.)
| –5000 to –5499 | A Toolbox instrument driver error code. (Constants are available in toolbox.h.)

A description of any of these error codes can be obtained using the GetGeneralErrorString function in the toolbox.fp instrument driver.