Select to view content in your preferred language

How to Disable a Tool control?

1335
2
01-06-2012 05:42 AM
AndyBridle
Deactivated User
Hi,

I'm writing an add-in in VS2010 in VB.Net for ArcMap 10.

I want to run some code whenever the selected tab in a tab control on the displayed form is changed so that it enables and selects the appropriate tool on my toolbar.
I'm using the code below to select the appropriate tool which is working fine but I would also like to disable (grey out) the other tools. Any ideas?

            Dim commandBars As ESRI.ArcGIS.Framework.ICommandBars = My.ArcMap.Application.Document.CommandBars
            Dim commandID As ESRI.ArcGIS.esriSystem.UID = New ESRI.ArcGIS.esriSystem.UIDClass
            commandID.Value = "esriArcMapUI.SelectFeaturesTool"
            Dim commandItem As ESRI.ArcGIS.Framework.ICommandItem = commandBars.Find(commandID, False, False)

            If Not (commandItem Is Nothing) Then
                My.ArcMap.Application.CurrentTool = commandItem
            End If
0 Kudos
2 Replies
sapnas
by
Frequent Contributor
I'm not sure if this is helpful but check out the below link that has an option to enable and disable the command member of ICommandItem.

http://edndoc.esri.com/arcobjects/8.3/componenthelp/esriCore/ICommand_Enabled.htm
0 Kudos
sapnas
by
Frequent Contributor
0 Kudos