IToolbarItem Interface

IToolbarItem Interface | Send Feedback
See Also Members

Allows access to a toolbar item.

# Syntax

Visual Basic |
--- | ---
    Public Interface IToolbarItem

C# |
--- | ---
    public interface IToolbarItem

JavaScript |
--- | ---
    Object dsToolbarItem

COM native C++ |
--- | ---
    interface IToolbarItem

C++ |
--- | ---
    class dsToolbarItem

# Example

The following code snippets show how to add a toolbar button with a ToolTip to a toolbar:

- COM native C++ (from the DraftSight API COM native C++ template file DsAddinConnection.cpp)
- C++ ( from the DraftSight API C++ template file dsAddinConnection.cpp)

#### COM native C++

> IToolbarPtr pToolbar = m_DsApp->AddToolbar( m_sApiUuid, dsUIState_Document, L"DsAddin Toolbar");

> IToolbarItemPtr pToolbarItem;

> pToolbarItem = pToolbar->InsertToolbarItem( m_sApiUuid, dsToolBarItemType_UserCommand, ++position, L"Open Notepad", pNotepad.GetUserCommandID() );

#### C++

> dsToolbar_ptr pToolbar;

> dsApp->AddToolbar( myApplication::appID, dsUIState_Document, ToolbarName, &pToolbar );

if( NULL != pToolbar )

{

> dsToolbarItem_ptr pToolbarItem;

> dsString ButtonName = L

"Notepad";

dsString UserCmdID;

pMenu->GetID( &UserCmdID );

pToolbar->InsertToolbarItem( myApplication::appID, dsToolBarItemType_UserCommand, 1, ButtonName, UserCmdID, &pToolbarItem );

Back to top

# Remarks

To display the list of available toolbars, right-click a toolbar in the DraftSight user interface and select Toolbars to open the Specify Toolbars dialog.

# Accessors

IToolbar::GetToolBarItems

IToolbar::InsertToolbarItem

# Object Model

Application

# See Also

####

IToolbarItem Members
Interop.dsAutomation Namespace
IToolbar Interface