views:

761

answers:

3
+2  Q: 

CMFCRebar problem

A: 

I've noticed a few visual problems when using the Office 2007 style too - it seems to be a little bit buggy. Can you use one of the others instead? XP Luna seems to be quite stable...

Stu Mackellar
Hey Stu! Thanks for your comment. The problem also happens with other styles. It's not so evident but it also has some visual "defects".
Javier De Pedro
Yes, I've also seen problems with other styles too, but none seem as bad as the Office 2007 ones. It seems that the theming mostly works until you try to do anything even slightly out of the ordinary.
Stu Mackellar
A: 

Basically you don't need to use a rebar control anymore. By simply creating your CMFCToolbars and CMFCMenuBar, calling EnableDocking on them and then using DockPane on each, they will dock and take on the Office 2007 (or whatever other theme you use) look-and-feel. Check out the WordPad Feature Pack sample, or create a new project (one with all the default settings is fine) using AppWizard to see an example.

Ok from your comment: if you want to dock toolbars next to each other you can use DockPaneLeftOf after DockPane. It tends to act strangely with toolbar placement in my experience if you don't DockPane both toolbars first.

I haven't found a good simple solution to stopping the toolbars from being dragged yet while docking next to each other, you can remove the CBRS_GRIPPER style, however that doesn't stop the toolbars from being dragged.

You can also just not call EnableDocking on the menubar or toolbars. This will make them fixed place. However, DockPaneLeftOf does not seem to work in this case, so you lose docking toolbars next to each other.

So it seems like one or the other right now if you want to stop docking, or dock toolbars next to each other.

Alisdair W
Hi Alisdair Walker,thanks for replying. Maybe you are right and the problem is I am not using the right control. But I want my toolbars not to be undocked by the user and I want my three toolbars in the same row. Could you help me to achive that?
Javier De Pedro
+1  A: 
demoncodemonkey
Thanks! That seems to be what I was looking for.Just one thing, could you let me know how do you create the toolbars? I mean which style you use in the Create/CreateEx instruction.
Javier De Pedro
I've edited with the creation code. It's whatever the MFC wizard created for me. You might also want to comment out the following line, to remove that nasty Add/Remove buttons thing at the end of each toolbar: //m_wndToolBar.EnableCustomizeButton(TRUE, ID_VIEW_CUSTOMIZE, strCustomize);
demoncodemonkey