Toolbar_New
- Updated2023-02-21
- 3 minute(s) read
int Toolbar_New (int parentPanel, int menuBar, const char *title, int top, int left, int conformBitmapColors, int conformToSystem, ToolbarType *newToolbar);
Purpose
Creates a new toolbar.
![]() |
Note If you are using Easy Tab controls and Toolbar controls in the same user interface, then create the Toolbar controls after creating the Easy Tab controls. This is because of limitations in the obsolete Easy Tab instrument. |
Parameters
| Input | ||
| Name | Type | Description |
| parentPanel | int | The handle of the panel on which to place the new toolbar. Obtain this handle from the LoadPanel, NewPanel, or DuplicatePanel functions. If you pass 0, the toolbar is created as a floating toolbar. To attach the toolbar programmatically, call Toolbar_Attach. A user also can attach the toolbar to any panel that you have specified as a dock point with Toolbar_AddDockPoint. |
| menuBar | int | The menu bar to associate with the toolbar. Associate a menu bar when you want to use your existing menu callbacks for toolbar callbacks as well. For example, if you had an Open File menu item in your panel menu bar, and you wanted to create a toolbar button that also performed Open File, you would specify your panel menu bar in Toolbar_New and the open file menu item in Toolbar_InsertItem. You can use GetPanelMenuBar to get the current menu bar handle for your panel. |
| title | const char * | The title for the new toolbar. The title appears in the toolbar title bar when the toolbar is undocked. LabWindows/CVI also uses the title to identify the toolbar when you call the Toolbar_SaveStates and Toolbar_LoadStates functions. |
| top | int | The vertical coordinate at which the upper left corner of the toolbar is placed. The coordinate must be an integer value from top applies to all toolbars on the panel if parentPanel is nonzero. If parentPanel is zero, this parameter is a global coordinate. Pass 0 to allow LabWindows/CVI to place the toolbar in an appropriate location. |
| left | int | The horizontal coordinate at which the upper left corner of the toolbar is placed. The coordinate must be an integer value from left applies to all toolbars on the panel if parentPanel is nonzero. If parentPanel is zero, this parameter is a global coordinate. Pass 0 to allow LabWindows/CVI to place the toolbar in an appropriate location. |
| conformBitmapColors | int | Specify a nonzero value or select Yes in the function panel if you want the bitmaps on your toolbar buttons to conform to the color scheme of the toolbar. Specify 0 or select No in the function panel if you want the bitmaps to appear on the toolbar buttons without modification. To conform your toolbar button bitmaps properly, your bitmaps should use VAL_PANEL_GRAY as the 3D object color and VAL_BLACK as the text color. You can use Get3dBorderColors to determine the proper color value for the highlight and shadow colors, which are based on the 3D object color. |
| conformToSystem | int | Specify a nonzero value or select Yes in the function panel if you want your toolbar to conform to the system colors. The toolbar background color and button color will conform to the system settings for 3D objects. Specify 0 or select No in the function panel if you want the toolbar to conform to the color scheme of the parent panel. Note that if the parent panel has the attribute ATTR_CONFORM_TO_SYSTEM set to 1, the result will be the same as if you specified Yes for this parameter, because conforming to the system colors and conforming to the parent panel colors will be equivalent. This setting does not affect the bitmaps on the toolbar buttons, only the toolbar background and the frame area of the toolbar buttons. |
| Output | ||
| Name | Type | Description |
| newToolbar | ToolbarType | Returns the new toolbar. |
Return Value
| Name | Type | Description |
| status | int | Return value indicating whether the function was successful. A negative number indicates that an error occurred. |
Additional Information
Library: Toolbar
Include file: custctrl\toolbar.h
LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later
Example
Refer to userint\activex\WebBrowser.cws for an example of using the Toolbar_New function.
