Hide Table of Contents
AddToolbarCommand2 Method (ISldWorks)

Specifies the application functions called by a toolbar button or sets a button to be 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

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

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 is...

Then in the user-interface, the button is...

0

Disabled and dimmed (also called grayed-out).

1

Enabled.

This is the default state if an update function is not specified.

2

Disabled and pressed in.

3

Enabled and pressed in.

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) 2011 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.