Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is there a way to enable / disable Add-In buttons / tools?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

According to the documentation this can be done in the OnUpdate method, Add-in coding patterns

share|improve this answer
    
Perfect. Thanks. Just curious, if the OnUpdate method is likely checked often, how much impact does a code placed there have on performance? Suppose I am checking the state of the editor and enable/disable commands based on it. Where is the best place to declare the editor? If Editor is used throughout the Add-In, should I declare it once globally say in a module? –  Jakub Nov 18 '10 at 13:58
    
@Jakub, the documentation states "Particularly time consuming operations, such as database queries, should never be performed within OnUpdate." So if you do checks of properties of objects in memory I don't think you will get in any problems. –  MathiasWestin Nov 18 '10 at 15:30
add comment

I got that wrong the first time . Not sure why I was thinking checked when you said enabled.

But enabled is boolean just like checked: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Enabled_Property/001v000000s0000000/

http://www.google.com/codesearch/p?hl=en#585OjyuBOxM/trunk/Umbriel.ArcMap.Addin/ShowSelectByLocation/ShowSelectByLocationButton.cs&q=Enabled%20package:http://umbriel%5C.googlecode%5C.com&l=70

Checked property.

For example, check out line #51 :[http://code.google.com/p/umbriel/source/browse/trunk/Umbriel.ArcMap.Addin/Umbriel.ArcMap.Addin.EditorTrack/EditorTrackToggleButton.cs#51][1]

[1]: http://code.google.com/p/umbriel/source/browse/trunk/Umbriel.ArcMap.Addin/Umbriel.ArcMap.Addin.EditorTrack/EditorTrackToggleButton.cs#51

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.