XLL+ Class Library (7.0)

CXlToolbar Class

Used to create run-time toolbars which are attached to the Excel main window.

class CXlToolbar

Overview

The CXlToolbar class can be used to create run-time toolbars which are attached to the Excel main window. Each toolbar can contain any number of buttons.

Note that all the methods of CXlToolbar are static. Thus, you need never instantiate an object of type CXlToolbar; instead you call each function with static scope, e.g.: CXlToolbar::AddToolbar("MyToolbar");

The toolbar should be usually be created during the CXllApp::OnXllOpenEx() event, using the AddToolbar() method. Once a toolbar has been created, tool buttons can be added using AddTool(). When the toolbar is completely set up, it can be made visible using ShowToolbar().

The toolbar should be removed during the CXllApp::OnXllClose() event, using the DeleteToolbar() method.

After Create() has been called, you can call functions to manipulate the buttons state, behavior and appearance, including: EnableTool, PressTool, SetToolBitmap, AssignToTool, and DeleteTool.

Internationalization

Many of the text arguments to CXlToolbar methods may be resource ID strings. These are loaded from the application resource file at run-time. For example, you can add a toolbar whose name is held in resource 234 in the resource file, as follows:

CXlToolbar::AddToolbar("#234");
The string will be loaded in the current user's preferred language, if available. See International support for more information.

The functions that accept and translate resource ID strings are listed below.

CXlToolbar::AddSeparator CXlToolbar::AddTool CXlToolbar::AddToolbar
CXlToolbar::AssignToTool CXlToolbar::DeleteTool CXlToolbar::DeleteToolbar
CXlToolbar::EnableTool CXlToolbar::PressTool CXlToolbar::SetToolBitmap
CXlToolbar::ShowToolbar    

Sample applications

You can find full examples of using the CXlToolbar class below:

Requirements

Header: xltoolbar.h

See Also

CXlToolbar Methods | xltoolbar.h | Toolbars (User Guide) | Toolbars sample | Toolbars sample using resources | Dynamic toolbars sample