G
GiuPa
Guest
I have to add the icons to a popup menu which is the correct way?
I did so:
I created the menu as a menu in the .rc file and added a normal toolbar
and i use this code for load and hide toolbar
//MainFrm.h
//
protected:
//...
CMFCToolBar m_wndInvisibleToolBar;
//...
//end MainFrm.h
//MainFrm.cpp here i placed
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
//....
if (m_wndInvisibleToolBar.Create(this))
{
// Only load
VERIFY(m_wndInvisibleToolBar.LoadToolBar(IDR_TOOLBAR1));
m_wndInvisibleToolBar.ShowPane(FALSE, FALSE, FALSE);
m_wndInvisibleToolBar.SetMaskMode(true);
// makes the toolbar
m_wndInvisibleToolBar.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndInvisibleToolBar);
}
The problem is that now the standard toolbar is no longer displayed at startup and also must be re-enabled at every reboot because it does not remain visible
instead the poup menu appears with the icons correctly !
Thanks
Edited changed:
//MainFrm.cpp
// Put the previous code before this line
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME))
Continue reading...
I did so:
I created the menu as a menu in the .rc file and added a normal toolbar
and i use this code for load and hide toolbar
//MainFrm.h
//
protected:
//...
CMFCToolBar m_wndInvisibleToolBar;
//...
//end MainFrm.h
//MainFrm.cpp here i placed
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
//....
if (m_wndInvisibleToolBar.Create(this))
{
// Only load
VERIFY(m_wndInvisibleToolBar.LoadToolBar(IDR_TOOLBAR1));
m_wndInvisibleToolBar.ShowPane(FALSE, FALSE, FALSE);
m_wndInvisibleToolBar.SetMaskMode(true);
// makes the toolbar
m_wndInvisibleToolBar.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_wndInvisibleToolBar);
}
The problem is that now the standard toolbar is no longer displayed at startup and also must be re-enabled at every reboot because it does not remain visible
instead the poup menu appears with the icons correctly !
Thanks
Edited changed:
//MainFrm.cpp
// Put the previous code before this line
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(theApp.m_bHiColorIcons ? IDR_MAINFRAME_256 : IDR_MAINFRAME))
Continue reading...