Accessing toolbar items

Each item in the toolbar should have a unique ID. Use these IDs to access the toolbar items in your application.

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

      void CMyAppView::DoSomethingToButton()
    {
    CAknToolbar* toolbar = Toolbar();
    if ( toolbar )
        {
        CAknButton* button = static_cast<CAknButton*>( toolbar->ControlOrNull( KButtonId ) );
        if ( button )
            {
            ...
            }
        }
    }