Accessing toolbar extension items

Like with the actual toolbar, each control in the toolbar extension should have a unique ID. You can access the toolbar extension controls from your application using these IDs.

The example below shows how to access toolbar extension items using the contol ID.

      void CMyAppView::DoSomethingToExtensionButton()
    {
    CAknToolbar* toolbar = Toolbar();
    if ( toolbar )
        {
        CAknToolbarExtension* toolbarExtension = toolbar->ToolbarExtension();
        if ( toolbarExtension )
            {
            CAknButton* button = 
                static_cast<CAknButton*>( toolbarExtension->ControlOrNull( KExtensionButtonId ) );
            if ( button )
                {
                ...
                } 
            }
        }
    }