This blog shows how you can add existing built-in commands to your existing custom toolbar or menu.
ArcGIS 10.1 introduced Python to the list of languages for creating desktop add-ins. To get started with Python add-ins or to learn more about customizing and extending desktop for ArcGIS with Python add-ins, check out the guide book available with the ArcGIS 10.1 desktop help.
If you already have a python add-in, you can easily add existing built-in commands to your custom toolbar or menu in three steps:
- Look up the command you want to add. The following links list the commands for each desktop application:
- Navigate to the folder where your add-in project is located and edit the config.xml file. Within the <Items> </Items> tags, add the following line and save and close the file.
- Rebuild and test your add-in. The following button will be available on your toolbar: When you select some features, the button is enabled and when clicked, the map will zoom to the selected features. If no features are selected, the button is disabled.
To add an existing tool command to a toolbar, follow the same steps as above. Instead of Button refID, use Tool refID:
Finally, here is an example of a built-in button command added to a custom menu. Note tools cannot exist on menus.