This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > IToolbarControl2 Interface > IToolbarControl2.CurrentTool Property (ArcObjects .NET 10.4 SDK) |
The current tool of the buddy.
[Visual Basic .NET] Public Property CurrentTool As ITool
[C#] public ITool CurrentTool {get; set;}
[C++]
HRESULT get_CurrentTool(
ITool** pVal
);
[C++]
HRESULT putref_CurrentTool(
ITool* pVal
);
[C++]
Parameters pVal [out, retval]
pVal is a parameter of type ITool pVal [in]
pVal is a parameter of type ITool
This is a shortcut to the CurrentTool of the Buddy. The Buddy implements the IToolbarBuddy interface that has a CurrentTool property. If no Buddy is set the CurrentTool returns Nothing.
On a ToolbarControl there is only ever one CurrentTool, and this is the item that appears 'pushed in'. If another tool is selected it becomes the new CurrentTool and the previous tool is deactivated.
If multiple ToolbarControls share the same CommandPool and have the same Buddy the CurrentTool is synchronised through the Buddy so only one item on all the ToolbarControl's will be the CurrentTool.
1039 800a040f: The supplied buddy is not a supported object
Always check that the Buddy has been set, before setting the CurrentTool or the method will fail.
When the CurrentTool is set the following events occur:
Within an ITool implementation it is recommended that the ITool::Deactivate event returns true. This allows a 'new' CurrentTool to be set, and allows the release of the CurrentTool when an application is shutting down.