Showing and hiding toolbar items

You can set toolbar items hidden or dimmed if a toolbar function is temporary unavailable.

The example below shows how to set a button unavailable. In the example, the boolean parameter aHide tells if the button should be hidden or dimmed.

void CMyAppView::SetButtonUnavailable( TBool aHide )
    {
    CAknToolbar* toolbar = Toolbar();
    if ( toolbar )
        {
        if ( aHide )
            {
            // To show the item again: 
            // toolbar->HideItem( KButtonId, EFalse, ETrue );
            toolbar->HideItem( KButtonId, ETrue, ETrue );
            }
        else
            {
            // To undim the item again:
            // toolbar->SetItemDimmed( KButtonId, EFalse, ETrue );
            toolbar->SetItemDimmed( KButtonId, ETrue, ETrue );
            }
        }
    }