Click to See Complete Forum and Search --> : hiding toolbars


djlovelock
May 8th, 1999, 03:38 PM
How can you enable the hiding and reappearance of additional toolbars.

Harvey Hawes
May 8th, 1999, 05:09 PM
Hi,

1) Create some resources on your menu to show and hide the tool bar (or context menu or whatever you want)

2) In your mainframe class, handle the command to show/hide the toolbar (for example, I handle OnViewHideToolbar1 in response to the user checking, or unchecking a menu item under the View menu).

The handler should look like this:


void CMainFrame::OnViewHideToolbar1()
{
// first check it visible state (hidden or visible)
BOOL bVisible = ((m_wndToolBar1.GetStyle() & WS_VISIBLE) != 0);
// then toggle
ShowControlBar(&m_wndToolBar1, !bVisible, NULL);
RecalcLayout();
}

// then manage the update handler
void CMainFrame::OnUpdateViewHideToolbar1(CCmdUI* pCmdUI)
{
BOOL bVisible = ((m_wndToolBar1.GetStyle() & WS_VISIBLE) != 0);
pCmdUI->SetCheck(bVisible); // depending on your menu's wording...
}




I got this from somewhere. Maybe the VC++ docs, maybe the net... not sure.

HTH,

Harvey Hawes

Software Engineer
BioScience Analysis Software Ltd.

Masters Candidate
Cardiovascular/Respiratory Sciences
Faculty of Medicine
University of Calgary
Calgary, Alberta, Canada