Select to view content in your preferred language

How to know that a custom tool is Active or Focussed?

513
4
05-30-2023 04:45 AM
newbiedotnetguy
Emerging Contributor

 

Hi,

Do we have OnActivate kind of thing in MapTool just like we have in DockPane to know whether the map tool is active or focussed (which we generally know when there is blue border around the whole pane or tool)?

 

@Wolf  @GKmieliauskas @UmaHarano 

0 Kudos
4 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

If I understood what you want, you can override  OnToolActivateAsync method if MapTool is yours.

To get which tool is active in ArcGIS Pro, you can use FrameworkApplication.ActiveTool

0 Kudos
newbiedotnetguy
Emerging Contributor

@GKmieliauskas  No I am talking about the small blue border that comes when clicked inside the pane or tool. And if clicked on the map that border disappears.

So I need to find a way to get that information when user clicked inside the UI to know it is focussed and when clicked on the map I need to know UI is now unfocussed. 

This same thing is present in dock pane using OnActivate.So similar kind of thing in map tool. There is one method not in MapTool but in Tool class by the name of OnPaneActivate but it is internal.

0 Kudos
GKmieliauskas
Esri Regular Contributor

MapTool has OnActivePaneChanged.

        protected override bool? OnActivePaneChanged(Pane pane)
        {
            return true;
        }
0 Kudos
newbiedotnetguy
Emerging Contributor

@GKmieliauskas  Ya I tried that but I was not be able to override the Tool class’s virtual methods when I am inheriting from MapTool class.

0 Kudos