Add a global variables to a toolbar

2850
4
09-28-2015 02:04 PM
MasroorHussain
New Contributor II

Hi,

I have created a toolbar for ArcGIS 10.3 using ArcObjects .NET10.3 c#.

It has couple of buttons and a tool. I want to set a global variable before any of these buttons and tools are created.

How can I do it.

Many thanks.

Masroor

0 Kudos
4 Replies
FreddieGibson
Occasional Contributor III

Could you describe the variable you're needing to set? If these buttons/tools are within the same project you could create a global variable within their source code and initialize it within the constructor of the buttons/tools.

MasroorHussain
New Contributor II

Hi Freddie,

I want to add a check that if Vector Layer Edit Mode is ON, enable all the buttons. By default I want the buttons to be disabled. Also, when the editing is done and mode is changed (Not Editing), I want to disable all the buttons.

Regards,

Masroor

0 Kudos
FreddieGibson
Occasional Contributor III

Have you tried modifying the Enabled property of the button using your logic to check if the editor is active within the OnUpdate method of the button.

Esri.ArcGIS.Desktop.Addins.Button

http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/#/Button_Class/001v000000r4000000/

MasroorHussain
New Contributor II

Hi Freddie,

I am doing the same and it works.

But I have to do it for all the buttons on a toolbar separately. I was wondering if we can do it for the Group and Set and Get the status by using some global Static Variable.

Also, I want to know if there is an order or 'initialization' if I create multiple buttons and tools in a toolbar.

Thank you.

Masroor

0 Kudos