To implement toolbars, you must first create commands and command lists for the toolbar. Then you will use a script to add the toolbars to your application.
You must create the commands and command lists that you will use for the toolbars in your application. Refer to Commands for information about creating commands and command lists.
For the best appearance, each command that you plan to use on a toolbar should have a 20 pixel by 20 pixel native picture defined for it. Each command should also have an appropriate tooltip.
Remember that you can use the built-in commands on toolbars as well. |
The CommandBar_Create() function is used to add toolbars to the application. This function creates a toolbar from the specified command list. If the command list for the toolbar contains another command list, that list will appear as a drop-down menu on the toolbar.
By default, the toolbars will be displayed on a single row. If the toolbars contain too many items to fit on that row, they will wrap to the next row. You can use the optional sequence and row paremters of CommandBar_Create() function to specify where each toolbar is created.
The sequence value for a toolbar indicates its relative position.
For applications using the multiple-document interface (MDI), the first toolbar in the upper-left corner has the sequence value 1. The toolbar next to it has the value 2, and so on for that row. The toolbars on the next row simply continue the sequence.
The following illustration shows the sequence numbers for 4 toolbars displayed for the Real Estate Sales Manager sample application.
For applications using the single-document interface (SDI), the sequence is the horizontal distance of the left edge of the toolbar, measured in pixels from the left edge of the main window.
How you use the sequence parameter when adding toolbars depends on whether your application is running in multiple-document or single-document mode. For MDI applications, start the value 1 for the first toolbar you add, the value 2 for the second, and so on. A sequence number shouldn’t repeat. For SDI applications, supply the actual offset from the left edge of the window as the sequence value.
The row parameter specifies the row you want the toolbar to appear in. The value 1 specifies being the first row. When adding toolbars, begin by adding those in the first row (row value 1), then those in the second row (row value 2), and so on.
Toolbars can be removed by using the CommandBar_Destroy() function. Removing a toolbar leaves the underlying command list unchanged.