Designing Toolbars and Cool Bars
A toolbar is a panel, usually across the top of a form (under the menu bar), that holds buttons and other controls. A cool bar (also called a rebar) is a kind of toolbar that displays controls on movable, resizable bands. If you have multiple panels aligned to the top of the form, they stack vertically in the order added.
You can put controls of any sort on a toolbar. In addition to buttons, you may want to put use color grids, scroll bars, labels, and so on.
You can add a toolbar to a form in several ways:
- Place a panel (TPanel) on the form and add controls (typically speed buttons) to it.
- Use a toolbar component (TToolBar) instead of TPanel, and add controls to it. TToolBar manages buttons and other controls, arranging them in rows and automatically adjusting their sizes and positions. If you use tool button (TToolButton) controls on the toolbar, TToolBar makes it easy to group the buttons functionally and provides other display options.
- Use a cool bar (TCoolBar) component and add controls to it. The cool bar displays controls on independently movable and resizable bands.
How you implement your toolbar depends on your application. The advantage of using the Panel component is that you have total control over the look and feel of the toolbar.
By using the toolbar and cool bar components, you are ensuring that your application has the look and feel of a Windows application because you are using the native Windows controls. If these operating system controls change in the future, your application could change as well. Also, since the toolbar and cool bar rely on common components in Windows, your application requires the COMCTL32.DLL. Toolbars and cool bars are not supported in WinNT 3.51 applications.
The following sections describe how to:
- Adding a Toolbar Using a Panel Component
- Adding a Toolbar Using the Toolbar Component
- Adding a Cool Bar Component
- Responding to Clicks
- Adding Hidden Toolbars
- Hiding and Showing Toolbars