Hi,
I have the proper code in my Add In to disable a button, but it only actually gets disabled after I try to click on it for the first time:
public AttributeUpdate()
{
editorUID.Value = "esriEditor.Editor";
Global.m_editor = ArcMap.Application.FindExtensionByCLSID(editorUID) as IEditor3;
}
protected override void OnUpdate()
{
Enabled = Global.m_editor.EditState != esriEditState.esriStateNotEditing;
}
Do I need to do something to for the 'OnUpdate' when the tool first loads?? I thought it would all happen automatically.
When ArcMap first starts the tool is enabled. Only after clicking on it will the 'OnUpdate' code start kicking in.
Thanks,
Solved! Go to Solution.
In the Config.esriaddinx file where you declare your button, you have to include 'onDemand="False"'. It's documented (although not very clearly) here in the section entitiled "Delay Loading"
This is an example of how it would look in your file
<ArcMap>
<Commands>
<Button id="yourID" class=yourClass" message="My Button" caption="Import from Table" tip="Import Scheme from Table" category="My Category" image="Images\ImportScheme_1.png" onDemand="false" />
In the Config.esriaddinx file where you declare your button, you have to include 'onDemand="False"'. It's documented (although not very clearly) here in the section entitiled "Delay Loading"
This is an example of how it would look in your file
<ArcMap>
<Commands>
<Button id="yourID" class=yourClass" message="My Button" caption="Import from Table" tip="Import Scheme from Table" category="My Category" image="Images\ImportScheme_1.png" onDemand="false" />
That works perfectly. Thanks.
Yes, the ESRI documentation is a bit sketchy. Hard to find things sometimes.