Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » something misunderstanding ??? Collapse All
Subject Author Date
Khoa Nguyen Tan Sep 15, 2003 - 11:29 AM

I’m working on a MDI project. In the CMainFrame::OnCreate, i have added two more things in order to support my need: hide all the toolbar when the application runs for the very first time. Everything is initialized step by step just like in your example:

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {

...

if(    !CExtControlBar::ProfileBarStateLoad(this,pApp->m_pszRegistryKey,
        pApp->m_pszProfileName,
        pApp->m_pszProfileName,
        &m_dataFrameWP ) )
    {
        DockControlBar( &m_wndMenuBar );
        DockControlBar( &m_wndToolBar );
DockControlBar( &m_wndGreek, FALSE, TRUE);
DockControlBar( &m_wndCapitalGreek, FALSE, TRUE);

        RecalcLayout();

// added to hide the toolbar when the application runs for the very
// first time.
        ShowControlBar( &m_wndGreek, FALSE, TRUE);
        ShowControlBar( &m_wndCapitalGreek, FALSE, TRUE);
    }
...

After doing that, I faced a problem: when I enable a toolbar and then close the program; launching the program for next time will show up an assertion fault like this:


Debug Assertion Failed!
Program: xxx
File: d:\temp\custom-control\src\ExtCmdManager.cpp
Line: 1609


I have followed the code and see that if I call:
ShowControlBar( &m_wndGreek, FALSE, TRUE);
when the toolbar initializes for the first time causes the problem.

The code have shown that it cann’t find info about Greek toolbar in registry (if I ignore the assertion failed message, everything still works fine).

I don’t know for sure what’s happening ??? Maybe what I have done is against the framework????

It would be great for me to have some advice.

Best regard.
PS: Sorry for long, bad writing.

Sergiy Lavrynenko Sep 18, 2003 - 1:00 PM

Hi,

Just one note before describing the problem solution: You have called CFrameWnd::ShowControlBar() with the third parameter set to TRUE. Frame window will mark this bar as delayed to be hidden during the nearest layout recalculation. So, you need to invoke CFrameWnd::RecalcLayout() manually for immediate feedback.

The assertion in question is caused by the command manager. I think the problem is in the command identifier of your bar. Normally each bar has identifier which is registered in the command manager (usually via appropriate show/hide menu item). May be you just forgot to add show/hide items into the frame window menu for your bar(s).

Best regards, Sergiy.

Khoa Nguyen Tan Oct 2, 2003 - 7:09 PM

Thanks for your help.