Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Adding dynamic Toolbars...
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Adding dynamic Toolbars...

 Post Reply Post Reply
Author
Message
guiuser1 View Drop Down
Groupie
Groupie
Avatar

Joined: 17 November 2015
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote guiuser1 Quote  Post ReplyReply Direct Link To This Post Topic: Adding dynamic Toolbars...
    Posted: 25 November 2015 at 2:52pm
I'm a bit stuck in how to add toolbars dynamically for a MDI application.
Depending on the settings, we optionally want to display a new toolbar...

We are so far a bit puzzled about how to go about this.

Any pointers?
Back to Top
guiuser1 View Drop Down
Groupie
Groupie
Avatar

Joined: 17 November 2015
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote guiuser1 Quote  Post ReplyReply Direct Link To This Post Posted: 25 November 2015 at 5:34pm
Found a solution but not sure this is the expected one.
We create a optional toolbar in the CMainFrame::OnCreate like normal,
set the toolbar to be non-visible: pToolBar->SetVisible(FALSE);
Then when a document is loaded, and with the proper settings in place, we force that toolbar to be visible by call pToolBar->SetVisible(TRUE);

As a side affect (I believe this is a bug), when saving and restoring the toolbars via the CXTPPropExchangeXMLNode, the toolbar becomes visible all the time, when the app is reloaded.  To fix that we had to put an additional call to pToolBar->SetVisible(FALSE); at the end of CMainFrame::ExchangeLayout(..)

It works but seems a bit untidy...
Suggestions?
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.