Is there a way to enable / disable Add-In buttons / tools?
2 Answers 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– Jakub Sisak GeoGraphics2010年11月18日 13:58:04 +00:00Commented Nov 18, 2010 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– MathiasWestin2010年11月18日 15:30:34 +00:00Commented Nov 18, 2010 at 15:30
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/
(削除) 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]