5

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

2

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

  • 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 Sisak GeoGraphics 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
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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