220 likes | 354 Views
ArcGIS 10 Add-In Components and Controls. Lesley Bross, August 25, 2010. Add-in Components. Button. Wizard generates a class that extends ESRI Button class to implement run-time behavior of button Buttons can be added to toolbars, menus, or tool palettes in the add-in configuration file
E N D
ArcGIS 10 Add-In Components and Controls Lesley Bross, August 25, 2010
Button • Wizard generates a class that extends ESRI Button class to implement run-time behavior of button • Buttons can be added to toolbars, menus, or tool palettes in the add-in configuration file • Users can add buttons to their toolbars through Customize… dialog • Example: override onClick() event with action to be taken; Buttons have no inherent action
Tool • Wizard generates a class that extends ESRI Tool class to implement run-time behavior of tool • Tools can be added to toolbars, menus, or tool palettes in the add-in configuration file • Users can add tools to their toolbars through Customize… dialog • Tools are different from buttons because they require interaction with the map • Example: override onMouseDown(), onMouseUp()
Button or Tool ? Tool • Button and tool images are packaged with the add-in • Tools stay active until a different tool is selected • Buttons trigger single actions Button
Combo Box • Wizard generates a class that extends ESRI ComboBoxclass to implement run-time behavior of tool • A combo box contains a drop-down list optionally headed by an editable field • Combo boxes can be added to toolbars in the add-in configuration file • Users can add combo boxes to their toolbars through Customize… dialog • Example: Items are added to the Combo Box in the New() method • Example: Respond to user selection by overriding OnSelChange() method
Editable combo box Combo Box
Multi-item • Wizard generates a class that extends ESRI MultItemclass to implement run-time behavior of menu items • A MultiItem contains a drop-down list of menu items may be dynamically built • MultiItem objects are linked to Menus in the add-in configuration file • MultiItem objects cannot be accessed outside a Menu • Example: A list of menu items is generated in the OnPopup() method; Updates on every access • Example: Respond to user selection by overriding OnClick() method
Multi-item menu • Note that the items on the menu are dynamically derived from the layers present on the map Multi-item menu
Extension • Wizard generates a class that extends ESRI Extension class to implement run-time behavior of the extension • Coordinates activities between user components in an add-in • Can store state associated with an add-in and respond to events thrown by ArcMap • Example: Override Initialize() method to set defaults • Example: Override Uninitialize() method to clean up
Editor Extension • Wizard generates a class that extends ESRI Extension class to implement run-time behavior of the editor extension • Generated class integrates with ArcMap editor framework and extension loads/unloads with edit session • Can automatically respond to selected events; Use for custom validation • Attributes window and digitizer extension are examples of editor extensions that ship with ArcMap • Example: Override Events_OnCreateChangeFeature() method to validate updates
Dockable Window • Wizard generates a class that extends ESRI DockableWindowclass to implement design and run-time behavior of the dockable window • Toggle window display with a combo box, menu item, or button • Use as a form to display/gather user information • Use toolbox in design mode to create form. Both Windows and ArcMap tools are available • Example: Override onClick() method for a button on the dockable window to process information on the form
Dockable Window example button to open/close window dockable window
Tool Palette • Configured in XML only • A compact way to group sets of tools or buttons. Columns attribute determines width • Grouping may include add-in tools that you create or built-in ArcMap tools • Tool palettes can be added to toolbars in the add-in configuration file • Users can add tool palettes to their toolbars through Customize… dialog
Tool Palette example tool palette
Toolbar • Configured in XML only • May contain buttons, tools, menus, tool palettes, and combo boxes • Toolbars can include commands that you create or built-in ArcMap tools • Toolbars may be configured to pop-up automatically when the add-in is added to ArcMap • Users can add toolbars to ArcMap through Customize… dialog
Menu • Configured in XML only • Drop-down list comprised of multi-items, buttons, and submenus • Menus can access commands that you create or built-in ArcMap tools • Menus are usually added to a toolbar but may appear independently • A multi-item is added to a menu and a menu is added to a toolbar
Menu example menu submenu
Context Menu • Configured in XML only • Similar to menus except they appear independently as pop-up menus linked to controls on a form • Positioned relative to the mouse position
Context menu example clicked button context menu