Hide Table of Contents
AddToolbarCommand2 Method (ISldWorks)

Specifies the application functions to be called when a toolbar button is pressed or sets a separator.

.NET Syntax

Visual Basic (Declaration) 
Function AddToolbarCommand2( _
   ByVal Cookie As Integer, _
   ByVal ToolbarId As Integer, _
   ByVal ToolbarIndex As Integer, _
   ByVal ButtonCallback As String, _
   ByVal ButtonEnableMethod As String, _
   ByVal ToolTip As String, _
   ByVal HintString As String _
) As Boolean
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim Cookie As Integer
Dim ToolbarId As Integer
Dim ToolbarIndex As Integer
Dim ButtonCallback As String
Dim ButtonEnableMethod As String
Dim ToolTip As String
Dim HintString As String
Dim value As Boolean
 
value = instance.AddToolbarCommand2(Cookie, ToolbarId, ToolbarIndex, ButtonCallback, ButtonEnableMethod, ToolTip, HintString)
C# 
bool AddToolbarCommand2( 
   int Cookie,
   int ToolbarId,
   int ToolbarIndex,
   string ButtonCallback,
   string ButtonEnableMethod,
   string ToolTip,
   string HintString
)
C++/CLI 
bool AddToolbarCommand2( 
&   int Cookie,
&   int ToolbarId,
&   int ToolbarIndex,
&   String^ ButtonCallback,
&   String^ ButtonEnableMethod,
&   String^ ToolTip,
&   String^ HintString
) 

Parameters

Cookie

Resource ID of the toolbar. This is the same Cookie you specified in ISwAddin::ConnectToSW

ToolbarId

Toolbar ID from SldWorks::AddToolbar4

ToolbarIndex

0-based index of the bitmap button

ButtonCallback

Function called when the user clicks the button (see Remarks)

ButtonEnableMethod

Function called to check whether or not the button should be enabled; typically used to check the type of object selected (see Remarks)

ToolTip

ToolTip for the toolbar button

HintString

Text that SolidWorks displays in the status bar when the user moves their mouse over this toolbar button

Return Value

True if successful, false if unsuccessful

Example

Remarks

See Add-in Callback and Enable Methods to learn how to specify ButtonCallback and ButtonEnableMethod.

Call this method to specify the functions that get called by the SolidWorks software when the button is pressed and to check if the button is enabled. Until this method is called, the SolidWorks software does not display the button.

If ButtonEnableMethod returns...

Then SolidWorks...

0

Deselects and disables the menu item

1

Deselects and enables the menu item; this is the default menu state if no update function is specified

2

Selects and disables the menu item

3

Selects and enables the menu item

To create a separator, all of the method's string parameters (ButtonCallback, ButtonEnableMethod, ToolTip, and HintString) must be blank strings. A bitmap button must still be defined in the add-in's resources, but it will not be used.

 

See Also

Availability

SolidWorks 2001Plus FCS, Revision Number 10.0


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   AddToolbarCommand2 Method (ISldWorks)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2012 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.