I'm trying to disable an AddIn button on Startup but no events related to the button fire until button is clicked.
I tried overriding the OnUpdate event for the button and also tried using the condition="E3_ArcGISLayerSelectedCondition" in the AddIns.xml. Both of these only fire once the button is clicked, which is too late. I want it to fire on Startup.
setting the arbitrary condition for the button to show within the button addin should work. I have used the condition "folder selected" (can't remember the exact name), and the associated button is disabled on start up. Is there another condition that is appropriate for what you are doing with the button?
A bit of a hack would be to use a second addin that is an extension. That extension addin can be easily set to run at Startup, and you can use that one to set the status of the button addin that you want disabled.
I tried multiple different conditions and I can never get it to fire. I actually already have an extension and I can't get to the button to disable it. The button isn't created until the button is clicked. To prove this, override the "New" function in your button and put a debug statement in there. For me, it doesn't get hit until the button is clicked.
' The following doesn't get hit until button is clicked. Even with the Condition in the AddIns.xml. Public Sub New() Me.Enabled = False End Sub
I am not sure what else to suggest, Al, except some basic things that you may have already tried.
Try creating a brand new button with a condition such as condition="E3_SingleFolderSelectedCondition" Don't even add any code to it and save it as the default name that MS Visual gives the solution.
Does the new button start out greyed out when you start up AGX with the default map?
Try deleting the current default map, then manually add in the test button yourself to the new default map that AGX automatically creates the next time you start the program.
As I said, the condition in AddIns.xml works on my system, so I can only assume it should work on yours if we can get things basic enough. What version of Windows and Visual Studio are you running? Norm
I just tried installing on a windows 7 64 bit/32 bit and Windows 8 no go. Tried creating a barebones, all defaults Explorer addin with one button and still no go. I have to click on the button before any disabling/enabling occurs.
This one has me stumped.
can you confirm that you are using Version 2500? I haven't tested on the earlier versions.