Fires after the ToolbarControl Buddy is set.
[Visual Basic 6.0] Event OnBuddyChanged As Empty
[Visual Basic .NET] Public Event OnBuddyChanged As OnBuddyChangedEventHandler
[C#] public event OnBuddyChangedEventHandler OnBuddyChanged
[C++]
HRESULT OnBuddyChanged(
void
);
Product Availability
Available with ArcGIS Engine.
Description
Fires when the SetBuddyControl method is used.
Any custom commands that are added to the ToolbarControl must be written in such a way as to ask the ToolbarControl for its Buddy every time an operation is requested to ensure they are always working with the current Buddy. Custom commands need to do one of two things:
- Either use the HookHelper, GlobeHookHelper or SceneHookHelper and always go to the 'hook' to get the IHookHelper, IGlobeHookHelper, and ISceneHookHelper properties, rather than storing them as member variables.
- Or use the IHookHelperEvents::OnHookUpdated event to repopulate any member variables pointing to the IHookHelper, IGlobeHookHelper, and ISceneHookHelper properties.
ICommand::OnCreate will only get called once for each command that is added to the ToolbarControl the first time the Buddy is set. Using the SetBuddyControl method to change the buddy a subsequent time will not call ICommand::OnCreate, but will fire the OnBuddyChanged event.