|So my app works using MFC toolbar creation without issue. If I set a flag, I can make it Dock or Float when the program is started using
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);. The code that does it lives in the
OnCreate which of course can only be called once. What I'm looking to do is use my property sheet to allow the user to select the mode of the toolbars
Floating which requires a method outside of the
OnCreate. So I have two buttons for testing, one to destroy the
toolbar (working) and create which "rebuilds" the toolbar....
I start off with the app in the
Docked mode, then I test by destroying the toolbar and then rebuilding it. The rebuild is where my issue is. On the
rebuild, it is "adding" some blank space equivalent to the two toolbars (
Button) and the toolbars
float....I can drag it out of where it was docked.....and the floating bar works.....but it "leaves behind" the a non functional version of the
floating toolbar where it was once docked. If I double click the floating bar, it jumps back to its previously docked location.
So I'm trying to figure out what is needed to correct my code that partially does what I want.....and fix the artifacts.
The code to destroy:
myPane.RemovePaneFromDockManager(&m_wndToolBar, TRUE, TRUE, TRUE, NULL);
The code to rebuild the toolbar:
m_wndOutput.AddStringStatusTab(_T("Error: Icon toolbar is already active, action cancelled"));
m_wndOutput.AddStringDebugTab(_T("Debug: MainFrame--Error: Icon toolbar is already active, action cancelled"));
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
TRACE0("Failed to Create Dialog ToolBar\n");
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, rcClientNew);
m_wndOutput.AddStringStatusTab(_T("I'm created 1 times"));
m_wndToolBar.ShowPane(TRUE, FALSE, TRUE); RecalcLayout();
In the rebuild, note the comment of where the problem begins.....If I comment out that line.....I can destroy and rebuild the toolbar with no issue, it is once I enable that line of code which creates the "float" of the toolbar action. I thought by destroying the toolbar and rebuilding it with the same options as the
OnCreate function with the float line mentioned above would do it.....but I get weird issues with the toolbar.
Here are images showing:
Rebuilt Toolbar with issues described:
Any ideas how I can solve this issue?
I can't find any code examples anywhere the float option isn't done outside of the
Hopefully someone can guide me?
You can see with all the commented code of things I've tried to see if I could fix it...
Thanks in advance!