I would like the user to right-click on the map and depending on the feature that was clicked, a custom context menu would show up rather than the default one. I know this is possible using a MapTool, but I don't want the user to have to first click the MapTool before having this functionality. I'd prefer that it is just automatically on at all times. Is that possible?
Solved! Go to Solution.
there are already built-in context menus for the mapview/scene view, depending on which COTS tool is active. Customize the relevant existing context menus to host your custom functionality - whether buttons, tools, menus, etc.
Here is an example of customizing the default map view context menu - shown when the "Explore" tool is active and the 2D selection menu shown when the "Select" tool is active. "<updateModule" goes in your Config.daml
<button id="TestAddin_Button1" caption="Test Addin 1" ... />
...
<updateModule refID="esri_mapping">
<menus>
<updateMenu refID="esri_mapping_popupToolContextMenu">
<deleteButton refID="esri_mapping_prevExtentButton"/>
<deleteButton refID="esri_mapping_nextExtentButton"/>
<deleteButton refID="esri_mapping_locateReverseGeocode"/>
<insertButton refID="TestAddin_Button1" insert="before"
placeWith="esri_mapping_cameraPropertiesControl"/>
</updateMenu>
<updateMenu refID="esri_mapping_selection2DContextMenu">
<deleteButton refID="esri_core_editCopyButton"/>
<deleteButton refID="esri_core_editPasteButton"/>
<deleteButton refID="esri_core_editDeleteButton"/>
<insertButton refID="TestAddin_Button1" insert="before"
placeWith="esri_editing_EditVerticesMove" separator="true"/>
</updateMenu>
</menus>
</updateModule>
.
Result:
there are already built-in context menus for the mapview/scene view, depending on which COTS tool is active. Customize the relevant existing context menus to host your custom functionality - whether buttons, tools, menus, etc.
Here is an example of customizing the default map view context menu - shown when the "Explore" tool is active and the 2D selection menu shown when the "Select" tool is active. "<updateModule" goes in your Config.daml
<button id="TestAddin_Button1" caption="Test Addin 1" ... />
...
<updateModule refID="esri_mapping">
<menus>
<updateMenu refID="esri_mapping_popupToolContextMenu">
<deleteButton refID="esri_mapping_prevExtentButton"/>
<deleteButton refID="esri_mapping_nextExtentButton"/>
<deleteButton refID="esri_mapping_locateReverseGeocode"/>
<insertButton refID="TestAddin_Button1" insert="before"
placeWith="esri_mapping_cameraPropertiesControl"/>
</updateMenu>
<updateMenu refID="esri_mapping_selection2DContextMenu">
<deleteButton refID="esri_core_editCopyButton"/>
<deleteButton refID="esri_core_editPasteButton"/>
<deleteButton refID="esri_core_editDeleteButton"/>
<insertButton refID="TestAddin_Button1" insert="before"
placeWith="esri_editing_EditVerticesMove" separator="true"/>
</updateMenu>
</menus>
</updateModule>
.
Result:
Can you use conditions to turn these updates to the context menu on and off depending on the state of the condition?
yes, same as u cld do if they were on the ribbon