You can dim or hide toolbar extension items if an extension item function is not available in certain cases.
The example below shows how to set the extension button unavailable. In
the example, the boolean parameter aHide
indicates if the
button should be hidden or dimmed.
void CMyAppView::SetExtensionButtonUnavailableL( TBool aHide ) { CAknToolbar* toolbar = Toolbar(); if ( toolbar ) { CAknToolbarExtension* toolbarExtension = toolbar->ToolbarExtension(); if ( toolbarExtension ) { if ( aHide ) { // To show the item again: // toolbar->HideItem( KExtensionButtonId, EFalse ); toolbarExtension->HideItemL( KExtensionButtonId, ETrue ); } else { // To undim the item again: // toolbar->SetItemDimmed( KExtensionButtonId, EFalse ); toolbarExtension->SetItemDimmed( KExtensionButtonId, ETrue ); } } } }