Select to view content in your preferred language

Edit tools not shown as selected in the Ribbon

575
1
Jump to solution
09-27-2023 02:40 AM
JamesAkaes
Emerging Contributor

 

Hi,

I have couple of edit tools (Modify Features) which are also shown in the Ribbon tabs. For these tools we have also created our own custom selection tool just like Pro's. This custom selection tool contains multiple tools inside based on different shapes like Rectangle, Polygon, Lasso (basically just like Pro's selection tool which is present inside Pro's edit tools UI). Now when our main custom edit tool is opened from Ribbon tab we are setting the Rectangle selection tool as active inside the custom tool's UI. But since we can open one map tool at a time so our main custom to not be closed and to remain open we have set property KeepControlOpenAfterDeactivation as true so that it will remain opened even if selection tool becomes active inside this custom tool. 

Now the problem is in regular scenarios when map tool is opened from the Ribbon and after it will become active, it will also be shown as selected in the Ribbon which will tell the users that this tool is active. But due to our specific case where a selection tool is becoming active inside our main tool it is not shown as selected in the Ribbon tab.

One way looks like to set Checked property of the button from which tool is opened.

And there is one more issue sometimes on first click tool UI is not visible but I know that the tool is active. And on second click tool UI appears. This usually happens when move from one tool to another from Ribbon.

@Wolf @GKmieliauskas @CharlesMacleod 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
John_Jones
Regular Contributor

Note that Pro has a single active tool at a time.  Activating a tool 'inside' your tool will end up deactivating the 'outter' tool.  Pro's editing tools that use selection are implemented as to not use the core selection tool which is a distinct tool.  Instead these tools (Move / Edit Vertices / Reshape etc) all implement selection by setting the viewer into selection mode while they are active as to remain active.  Basically they have internal modes "selection" mode and the tool's normal mode where they handle selection all themselves (without activating a core selection tool) note also that these editing tools typically filter the selections being set so that only acceptable inputs for that tool are selectable.  SDK assistance in implementing this pattern could be provided, as I'm not sure that the public API has all the same functionality that we use internally, but that isn't currently available.  If all the relevant APIs are in the public API we can provide a sample that helps follow this pattern but if not additional SDK will need to be exposed in a future release.  In the meantime I expect you are able to continue following your current pattern.  You can also write a custom button with overloaded Checked logic which says it is checked when any one of a number of tools is the active tool and when clicked activates the main entrypoint tool.  Then put this 'tool activation button' on the ribbon rather than the actual tool.

View solution in original post

0 Kudos
1 Reply
John_Jones
Regular Contributor

Note that Pro has a single active tool at a time.  Activating a tool 'inside' your tool will end up deactivating the 'outter' tool.  Pro's editing tools that use selection are implemented as to not use the core selection tool which is a distinct tool.  Instead these tools (Move / Edit Vertices / Reshape etc) all implement selection by setting the viewer into selection mode while they are active as to remain active.  Basically they have internal modes "selection" mode and the tool's normal mode where they handle selection all themselves (without activating a core selection tool) note also that these editing tools typically filter the selections being set so that only acceptable inputs for that tool are selectable.  SDK assistance in implementing this pattern could be provided, as I'm not sure that the public API has all the same functionality that we use internally, but that isn't currently available.  If all the relevant APIs are in the public API we can provide a sample that helps follow this pattern but if not additional SDK will need to be exposed in a future release.  In the meantime I expect you are able to continue following your current pattern.  You can also write a custom button with overloaded Checked logic which says it is checked when any one of a number of tools is the active tool and when clicked activates the main entrypoint tool.  Then put this 'tool activation button' on the ribbon rather than the actual tool.

0 Kudos