Discussion:
CMFCToolbar
(too old to reply)
Geoyar
2008-07-14 22:56:01 UTC
Permalink
Hi,

I have problems with CMFCToolBar.

I am using the slider sample from Samples\C++\MFC\Visual C++ Feature
Pack\Slider and VS2008 Standard.

I added my CMFCToolbar member, m_wndMyTB , to MainFrm.h and added

CMFCToolBar::SetLargeIcons();

......................................
if (!m_wndMyTB.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE |CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS |CBRS_FLYBY | CRBS_SIZE_DYNAMIC) ||
!m_wndMyTB.LoadToolBar(IDR_MYTB))
{
TRACE0("Failed to create toolbar MyTB\n");
return -1; // fail to create
}

m_wndMyTB.SetButtonText(0, CString(_T("NoApple")));
m_wndMyTB.SetButtonText(1, CString(_T("Visa")));

.............................

m_wndMyTB.EnableDocking(CBRS_ALIGN_ANY);

................................

DockPane(&m_wndMyTB);

.................................

m_wndMyTB.EnableCustomizeButton (TRUE, ID_VIEW_CUSTOMIZE, _T("Customize..."));

to CMainFrame::OnCreate().

The new toolbar was displayed to the right of the standard toolbar with the
slider control on the standard toolbar, but:

1. In View\toolbars menu I see only one, standard toolbar.
2. In the Customize dialog box\toolbars I see menu bar and two standard
bars, the first is my MyTB (under name Standard) and the second toolbar is
the ntoolbar from the slider example.
3. The app does not react on my attempt to show labels for m_wndMyTB and do
not show labels for the standard toolbar from OnCreate like
m_wndToolBar.EnableTextLabels(FALSE) and m_wndMyTB.EnableTextLabels().
It displays and hides labels only from the Customise\toolbars Show Text
Labels check box. But after you chech the box for m_wndMyTB once and exit the
app, on the next start it shows labels for both toolbars.

Any help?

My machine is HP Pavilion a120n under Window XP SP2.

Please respont to ***@toast.net

Thank you

geoyar
x***@gmail.com
2008-08-13 19:22:26 UTC
Permalink
Post by Geoyar
Hi,
I have problems with CMFCToolBar.
I am using the slider sample from Samples\C++\MFC\Visual C++ Feature
Pack\Slider and VS2008 Standard.
I added my CMFCToolbar member, m_wndMyTB , to MainFrm.h and added
  CMFCToolBar::SetLargeIcons();
......................................
 if (!m_wndMyTB.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE |CBRS_TOP
 | CBRS_GRIPPER | CBRS_TOOLTIPS |CBRS_FLYBY | CRBS_SIZE_DYNAMIC) ||    
!m_wndMyTB.LoadToolBar(IDR_MYTB))
  {
         TRACE0("Failed to create toolbar MyTB\n");
         return -1;      // fail to create
 }
 m_wndMyTB.SetButtonText(0, CString(_T("NoApple")));
 m_wndMyTB.SetButtonText(1, CString(_T("Visa")));
.............................
  m_wndMyTB.EnableDocking(CBRS_ALIGN_ANY);
................................
   DockPane(&m_wndMyTB);
.................................
m_wndMyTB.EnableCustomizeButton (TRUE, ID_VIEW_CUSTOMIZE, _T("Customize..."));
to CMainFrame::OnCreate().
The new toolbar was displayed to the right of the standard toolbar with the
1. In View\toolbars menu I see only one, standard toolbar.
2. In the Customize dialog box\toolbars I see menu bar and two standard
bars,  the first is my MyTB (under name Standard) and the second toolbar is
the ntoolbar from the slider example.
3. The app does not react on my attempt to show labels for m_wndMyTB and do
not show labels for the standard toolbar from OnCreate like
m_wndToolBar.EnableTextLabels(FALSE) and m_wndMyTB.EnableTextLabels().
It displays and hides labels only from the Customise\toolbars Show Text
Labels check box. But after you chech the box for m_wndMyTB once and exit the
app, on the next start it shows labels for both toolbars.
Any help?
My machine is HP Pavilion a120n under Window XP SP2.
Thank you
geoyar
Hi,

I have the same problem, when a create a new toolbar i think that the
manager can't add a new toolbar.
I'm tryed to create using Create() but the same happens, if i found
some way to solve this i will post here.
Gaetan Noiseux
2011-07-29 13:58:48 UTC
Permalink
if (!m_wndMyTB.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE |CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS |CBRS_FLYBY | CRBS_SIZE_DYNAMIC,CRect(1, 1, 1, 1), IDR_MYTB) ||
!m_wndMyTB.LoadToolBar(IDR_MYTB))

CRect(1, 1, 1, 1), IDR_TOOLBAR1
added to the command made it work

all the three points work fine with this modification
Post by Geoyar
Hi,
I have problems with CMFCToolBar.
I am using the slider sample from Samples\C++\MFC\Visual C++ Feature
Pack\Slider and VS2008 Standard.
I added my CMFCToolbar member, m_wndMyTB , to MainFrm.h and added
CMFCToolBar::SetLargeIcons();
......................................
if (!m_wndMyTB.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE |CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS |CBRS_FLYBY | CRBS_SIZE_DYNAMIC) ||
!m_wndMyTB.LoadToolBar(IDR_MYTB))
{
TRACE0("Failed to create toolbar MyTB\n");
return -1; // fail to create
}
m_wndMyTB.SetButtonText(0, CString(_T("NoApple")));
m_wndMyTB.SetButtonText(1, CString(_T("Visa")));
.............................
m_wndMyTB.EnableDocking(CBRS_ALIGN_ANY);
................................
DockPane(&m_wndMyTB);
.................................
m_wndMyTB.EnableCustomizeButton (TRUE, ID_VIEW_CUSTOMIZE, _T("Customize..."));
to CMainFrame::OnCreate().
The new toolbar was displayed to the right of the standard toolbar with the
1. In View\toolbars menu I see only one, standard toolbar.
2. In the Customize dialog box\toolbars I see menu bar and two standard
bars, the first is my MyTB (under name Standard) and the second toolbar is
the ntoolbar from the slider example.
3. The app does not react on my attempt to show labels for m_wndMyTB and do
not show labels for the standard toolbar from OnCreate like
m_wndToolBar.EnableTextLabels(FALSE) and m_wndMyTB.EnableTextLabels().
It displays and hides labels only from the Customise\toolbars Show Text
Labels check box. But after you chech the box for m_wndMyTB once and exit the
app, on the next start it shows labels for both toolbars.
Any help?
My machine is HP Pavilion a120n under Window XP SP2.
Thank you
geoyar
Post by x***@gmail.com
S_TOP
=A0
."));
he
r is
do
the
Hi,
I have the same problem, when a create a new toolbar i think that the
manager can't add a new toolbar.
I'm tryed to create using Create() but the same happens, if i found
some way to solve this i will post here.
Loading...