Use the method MAknToolbarObserver::DynInitToolbarL() to set properties of toolbar items before the toolbar is shown.
DynInitToolbarL()
is
used for the toolbar notifying the observer when the toolbar is about to be
shown. This way you can use the toolbar observer to initialize the toolbar
before showing it, for example by dimming or hiding certain controls if their
functions are not available.
The example below shows how to hide a toolbar item before the toolbar is drawn.
void CMyAppView::DynInitToolbarL( TInt aResourceId, CAknToolbar* toolbar ) { if ( toolbar ) { toolbar->HideItem( KButtonId, ETrue, EFalse ); } }