Select to view content in your preferred language

Custom ToolBar with custom commands and menus

3082
10
09-11-2013 12:33 AM
A_Kipfer
Emerging Contributor
Hi,

I need to create a custom toolbar programmatically and add custom commands / menus to it. The whole toolbar needs to be persistent and be handed over to other people.

In the last weeks I was fuzzing around with .NET and IToolBardef, BaseCommand, ICommandItem and what not but I just couldn't add the custom commands to the toolbar, just standard ESRI-commands would work.

Can you please tell me, if I can use Python Scripting for this and is it possible to start Python scripts from xaml-Dialogs? I know there are a couple of Python tutorials around but before I invest a lot of time again I'd like to know if Python scripting is basically the right approach to fulfill my tasks.

Thanks a lot in advance for your help!

Edit: Sorry, I forgot to mention that I use VS 2010 with .NET3.5 for ArcGIS 10.0 and higher.

Kianar
Tags (2)
0 Kudos
10 Replies
A_Kipfer
Emerging Contributor
Hi jamesfreddy,

thanks a lot for your explanatations. I did a lot of research already and found the info that it's not possible to create custom commands at runtime (http://forums.arcgis.com/threads/11155-Add-dynamically-created-command-to-dynmically-created-menu).

That's why I thought that Python might be an option. In case you see a way to create custom commands at runtime, please don't hesitate so let me know how :-). But this is a topic for another forum anyway...

Regards
Kianar


Your most appropriate options are:

1. COM/ArcObjects Components
2. .NET Add-In

Without knowing what kind of functionality you plan to build, I'd say any significant map interaction should be handled with ArcObjects as the Python mapping library simply is not that extensive and will limit your options.  But as Hornbydd  alludes to, it depends on the functionality you plan to provide.

The biggest difference between the two options listed above I think resides with getting your tools distributed.  I don't have experience with the .NET Add-in, but from what I understand it affords much more UI development tools than the Python Add-In does, but is more limited than a full-blown COM component. 

The .NET Add-In has the advantage of easy distribution, while the COM/ArcObjects tools will need to have Installer.msi/.exe component and must be run to get your tools installed on the end-user's workstation.

I can assure you that  IToolBardef, BaseCommand, ICommandItem all work fine and you simply need to do more research and testing to get it to work.
0 Kudos