Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » How to hide Toolbar Items or swap them Collapse All
Subject Author Date
Douglas Hoppes Aug 31, 2010 - 12:28 PM

Hi all,

I’m trying to figure out the best method to solve this issue. On my toolbar, I have a Toolbar Button called "Review Images". I also have a Toolbar Button called "Show Live". I want to toggle these icons. The only methods that I see are to remove and insert the toolbar buttons.

Is there an easy method to swap icons or to show one icon and not the other?


Technical Support Aug 31, 2010 - 12:55 PM

It’s possible to hide any toolbar button by applying the TBBS_HIDDEN toolbar button style:

UINT nCommandID = . . .
bool bShowButton = . . .
CExtToolControlBar * pToolBar = . . .
int nButtonIndex = pToolBar->CommandToIndex( nCommandID );
            if( nButtonIndex < 0 )
                        return . . .
CExtBarButton * pTBB = pToolBar->CommandToIndex( nButtonIndex );
            ASSERT_VALID( pTBB );
UINT nAdd = bShowButton ? 0 : TBBS_HIDDEN;
UINT nRemove = bShowButton ? TBBS_HIDDEN : 0;
            pTBB->ModifyStyle( nAdd, nRemove );
CFrameWnd * pWndParentFrame = pToolBar->GetParentFrame();
            if( pWndParentFrame == NULL )
                        return . . .
But, unfortunately, button swapping is not supported. But changing toolbar buttons with CExtToolControlBar::SetButtons(), CExtToolControlBar::LoadToolBar(), CExtToolControlBar::InsertButton()>, CExtToolControlBar::InsertSpecButton()> and/or CExtToolControlBar::RemoveButton() is fast.