MFC: Updating Toolbar Buttons on Floating Toolbar

MFC: Updating Toolbar Buttons on Floating Toolbar

Post by David W. Shoo » Wed, 27 Jul 1994 12:06:34

I've created a separate CFrameWnd as a WS_POPUPWINDOW from the main
CFrameWnd and attached a CToolbar to it, creating a great little floating
toolbar (I draw my own small caption bar).  The only problem is that it's
buttons are only updated (checked/unchecked) when the WM_COMMAND
originates from selecting the Floating Toolbar's button.  They are NOT
updated if the corresponding Menu item or toolbar button on the main
CFrameWnd are chosen, causing one button to be checked while the other
button/menu item to be unchecked (or vice versa).  The main window's
toolbar and menu _ARE_ updated correctly regardless of _WHERE_ the command
originates.  I've tried adding separate UI handlers for the floating
toolbar, but they're never called.

I'm assuming, of course, that the Framework automatically updates the
UI for _ALL_ Frame windows (since it keeps track of all that exist).

Anyone with any ideas?  This would be perfect for my needs if I can get
it working.

Thanks to those willing to help.



1. Floating Toolbar with MFC 3.0 and VC++ 2.0


I have a problem with a floating toolbar (CControlBar) in MFC 3.0 and MS
Visual C++ 2.0 under NT 3.5.

I create a CToolBar object in my CView's OnCreate method and makes it
floating by calling FloatControlBar on my frame window. The floating
toolbar shows up and works correctly, but when I destroy my window the
floating toolbar stays on the screen, but now without buttons. Then if I
try to press the mouse button over it I get an exeption in MFC30.DLL.

It doesn't seem like the CControlBar gets deleted from the frame's list of
CControlBar's, but if I trace the desctructor for my CView that created
the toolbar, everything seems to be in order and MFC is calling
RemoveControlBar (Internal MFC func) on my frame window and removes the
toolbar, but yet it still remains on the screen.

What shall I do? I don't want to create my toolbar in my CFrameWnd's
OnCreate func, because I can have different document types using different
toolbars, and I wan't it to work like the menu does with multiple document

Any suggestions?

 * Mats Ljungqvist       * #pragma message("Standard disclaimer in use")
 * Juristdata AB, SWEDEN * Professional development for Windows NT
 * Phone +46-500 412150  * Fax +46-500 412848

2. Coax cable length

3. Can't update the toolbar w/ MFC -- HELP!

4. Umm...Syntax for != in Lotus Script? HELP

5. disabling toolbar buttons in MFC

6. HTML UI with the web browser control

7. toolbar buttons with combo buttons not getting ON_UPDATE_COMMAND_UI messages

8. CS position at Haifa University

9. changing the button highlight color of a toolbar button

10. Toolbars, or not toolbars.

11. Problems destroying toolbar and statusbar/finding info on toolbar

12. Toolbar image change , icon to bitmap for toolbar, AddBitmap

13. Floating/Flat Style Toolbars with API