This document is archived and information here might be outdated.  Recommended version.


IToolbarControl.SetBuddyControl Method (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Controls)  

IToolbarControl.SetBuddyControl Method

Sets a control to be a buddy of the toolbar, this control must support IToolbarBuddy.

[Visual Basic .NET]
Public Sub SetBuddyControl ( _
    ByVal pToolbarBuddy As Object _
)
[C#]
public void SetBuddyControl (
    object pToolbarBuddy
);
[C++]
HRESULT SetBuddyControl(
  IDispatch* pToolbarBuddy
);
[C++]

Parameters pToolbarBuddy [in]
pToolbarBuddy is a parameter of type IDispatch

Product Availability

Available with ArcGIS Engine.

Description

Pass the SetBuddyControl method a MapControl, PageLayoutControl, SceneControl, GlobeControl or object implementing IToolbarBuddy. To clear the Buddy set the property to Nothing.

The ToolbarControl is passed as the hook parameter to the ICommand::OnCreate method of each item's command on the ToolbarControl. Each command will typically check the type of Buddy that has been set before becoming enabled. For example, a 'map zoom in' tool will only become enabled if the Buddy is a control that has a Map object ie. a MapControl or PageLayoutControl.

Errors Returned

1039 800A040F: The supplied buddy is not a supported object 

See Also

IToolbarControl Interface