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 Tech Support » Problem with docking state of dynamic control bars Collapse All
Subject Author Date
Gevork Odabashyan Oct 23, 2006 - 5:26 AM

Hellow

I want my dynamic control bars not to appear in all menus in hide mode. To do this, I’v overriden CExtDynamicControlBar::BarStateSet and CExtDynamicControlBar::OnInsertDynamicBarCommandIntoPopupMenu methods of my dynamic control bar class, first for for default Prof-UIS context menu, and second for the pop-up menu with a list of all dynamic control bars of main menu. In floating state all works fine. But if we set two control bars to docking mode, place them in same floating container and then hide the floating container, we could see two problems. First, CExtDynamicControlBar::BarStateSet is not called in this case, so control bars menu items still remain in default Prof-UIS context menu. If we close test sample and then start it again, we can see the second problem - assert in extcontrolbar.cpp at line 4554. The sample dynamic_bar_sample4.rar was sent to support@prof-uis.com.

Technical Support Oct 23, 2006 - 1:04 PM

We received your project and replied by e-mail.

Gevork Odabashyan Oct 24, 2006 - 7:35 AM

I’ve got some problems with this e-mail. Could you send the reply again?

Technical Support Oct 25, 2006 - 11:26 AM

Dear Gevork,

If you know the ftp details, please download the updated source code (Prof-UIS-262.zip) from our ftp site. If you don’t know the details, would you send us some other email address? It seems our replies just are just filtered off.

Gevork Odabashyan Oct 26, 2006 - 11:32 PM

I’ve downloaded version 2.62. The bug described in my post of this topic from Oct 25, 2006 - 11:05 AM is still actual:

The menu problem has gone, but another one has appeared. To see it, please do the following in attached sample:
1) Create dynamic bar 1
2) Create dynamic bar 2
3) Change state both of them to docking
4) Place bars in same floating container
5) Hide floating container
6) Activate dynamic bar 1 (click "Create dynamic bar\Bar 1" again, bar will be activated if it’s already created )
The size of activated bar restores wrong.
Attached sample was sent to support@prof-uis.com from new e-mail.

P.S. If we activate dynamic bar 2 after step 6), we’ll see assertion in extdockbar.cpp at line 4488.

Gevork Odabashyan Oct 26, 2006 - 4:18 AM

I’ve lost ftp details. And I’ve changed e-mail in my profile. Please send ftp details to this address.

Technical Support Oct 24, 2006 - 8:16 AM

We sent it to you again (using our gmail account this time).

Gevork Odabashyan Oct 25, 2006 - 11:05 AM

The menu problem has gone, but another one has appeared. To see it, please do the following in attached sample:
1) Create dynamic bar 1
2) Create dynamic bar 2
3) Change state both of them to docking
4) Place bars in same floating container
5) Hide floating container
6) Activate dynamic bar 1 (click "Create dynamic bar\Bar 1" again, bar will be activated if it’s already created )
The size of activated bar restores wrong.
Attached sample was sent to support@prof-uis.com from new e-mail.

Technical Support Oct 27, 2006 - 6:55 AM

To fix this problem, which has to do only with dynamic control bars, please update the following method in the ExtControlBar.cpp file:

 
bool CExtDynamicBarNcAreaButtonClose::OnNcAreaClicked( CPoint point )
{
    ASSERT_VALID( this );
    if( ! m_rc.PtInRect( point ) )
        return false; // continue asking nc-buttons
    m_bHover = m_bPushed = false;
CExtControlBar * pExtBar = GetBar();
    ASSERT_VALID( pExtBar );
    CExtBarNcAreaButtonClose::OnNcAreaClicked( point );
    if( pExtBar->NcButtons_HandleClick( this, point, pExtBar, NULL ) )
        return true;
CExtDynamicControlBar * pBar = DYNAMIC_DOWNCAST( CExtDynamicControlBar, pExtBar );
    if( pBar != NULL )
        pBar->BarStateSet( pBar->BarStateGet(), false );
    return true;
}


Then please replace the line 4488 in the ExtDockBar.cpp file with the following:
    //ASSERT( nBarMetricRef >= nBarMinMetric );
    if( nBarMetricRef < nBarMinMetric )
        nBarMetricRef = nBarMinMetric;
Finally, we have modified the CMainFrame::CreateMyDynamicBar() method in your project:
void CMainFrame::CreateMyDynamicBar(LONG id)
{
    CMyControlBarsContainer::iterator bar_it = m_myControlBars.find(id);
    if (bar_it == m_myControlBars.end())
    {
        CExtCmdIcon icon = g_CmdManager->CmdGetIcon(__PROF_UIS_PROJECT_CMD_PROFILE_NAME, ID_FILE_NEW);
        CString caption;
        caption.Format(_T("Dynamic bar %d"), id);
        CMyDynamicBar* bar = dynamic_cast<CMyDynamicBar*>(CExtDynamicBarSite::BarAlloc(caption, icon, 0, RUNTIME_CLASS(CMyDynamicBar), false));
        ASSERT(bar);
        m_myControlBars.insert(make_pair(id, bar));
        bar->m_nMdiMenuResourceID = IDR_foss_dyn2TYPE;
        bar->m_nMdiAccelTableResourceID = IDR_MAINFRAME;
        UINT nCmdID = (UINT)bar->GetDlgCtrlID();
        CExtCmdItem* pCmdItem = g_CmdManager->CmdGetPtr(__PROF_UIS_PROJECT_CMD_PROFILE_NAME, nCmdID);
        ASSERT(pCmdItem != NULL);
        pCmdItem->StateSetBasic();
        CSize sizeDesiredDocked(100, 100);
        CSize sizeDesiredFloating(170, 120);
        bar->SetInitDesiredSizeHorizontal(sizeDesiredDocked);
        bar->SetInitDesiredSizeVertical(sizeDesiredDocked);
        bar->SetInitDesiredSizeFloating(sizeDesiredFloating);
        bar->m_dealDlg.m_id = id;
        bar->BarStateSet(CExtDynamicControlBar::__EDBS_FLOATING, true);
        bar->OnRepositionSingleChild();
    }
    else
    {
        bar_it->second->BarStateSet(bar_it->second->BarStateGet(), true);
    }
}


Gevork Odabashyan Oct 27, 2006 - 8:41 AM

I’m sorry guys, but problem still exists. The method CExtDynamicBarNcAreaButtonClose::OnNcAreaClicked is not invoked at all when I do the steps described earlier. I sent the patched sample to you.
By the way, is there a way to srt initial floating position to dynamic control bar? What method and when should I use for it in my method CMainFrame::CreateMyDynamicBar()?

Technical Support Oct 30, 2006 - 10:48 AM

The CExtDynamicBarNcAreaButtonClose::OnNcAreaClicked() is really not invoked when you have multiple control bars inside one floating mini frame window. The "X"-button in the caption is an instance of CExtBarNcAreaButtonClose inside a CExtDynControlBar bar window which is a container for all other bars in the mini frame window. Prof-UIS 2.62 introduces a new simpler way to catch clicks on caption buttons without having to define button classes. The new CExtControlBar::NcButtons_HandleClick() virtual method allows you to get notifications and/or handle any caption button clicks. This method is invoked for all child bars in the floating mini frame window and allows you to determine which bar relates to the click.

You can use the CExtControlBar::SetInitDesiredPosFloating() and CExtControlBar::SetInitDesiredSizeFloating() methods to set the desired location of the floating bar. These methods should be invoked before switching bars into the floating state.

Gevork Odabashyan Oct 30, 2006 - 11:11 AM

I’m sorry again, but needn’t to catch clicks on caption buttons. All I need is correct work of dynamic control bars. You gave me three pieces of code I needed to patch. One of them was CExtDynamicBarNcAreaButtonClose::OnNcAreaClicked(). So imho this method must be used to solve the problem. I simply told you that this method is not invoked. And that the size of activating dynamic control bar restores wrong if this bar is in floating container with second bar. Please check again this steps:

The menu problem has gone, but another one has appeared. To see it, please do the following in attached sample:
1) Create dynamic bar 1
2) Create dynamic bar 2
3) Change state both of them to docking
4) Place bars in same floating container
5) Hide floating container
6) Activate dynamic bar 1 (click "Create dynamic bar\Bar 1" again, bar will be activated if it’s already created )
The size of activated bar still restores wrong.

Gevork Odabashyan Nov 1, 2006 - 12:55 AM

I’ve downloaded your last update. It seems the state of dynamic control bars restores well. But I found one problem after this update. If we hide mini frame with several control bars in it by clicking on miniframe’s "X" button, the CExtDynamicControlBar::BarStateSet virtual funtion is not called. Please check this moment.

Technical Support Nov 1, 2006 - 7:00 AM

The problem is caused by an unwanted condition check (pNcAreaButton->OnQueryVisibility()) in the CExtDynamicControlBar::NcButtons_PostClick() method. You can fix this by updating the source code for this method in the ExtControlBar.cpp file:

void CExtDynamicControlBar::NcButtons_PostClick(
    CExtBarNcAreaButton * pNcAreaButton,
    CPoint point,
    CExtControlBar * pBarEventSource,
    CExtControlBar * pBarActiveInContainer
    )
{
    ASSERT_VALID( this );
    ASSERT_VALID( pNcAreaButton );
    ASSERT_VALID( pBarEventSource );
#if (defined _DEBUG)
    if( pBarActiveInContainer != NULL )
    {
        ASSERT_VALID( pBarActiveInContainer );
    }
#endif // (defined _DEBUG)
    if(        /*
            pNcAreaButton->OnQueryVisibility()
            && */
        pNcAreaButton->IsKindOf( RUNTIME_CLASS(CExtBarNcAreaButtonClose) )
        )
    {
        bool bIsVisible = false;
        CExtDynamicControlBar::eDynamicBarState_t eDBS =
            BarStateGet( &bIsVisible );
        if(        bIsVisible
            &&    (    eDBS == CExtDynamicControlBar::__EDBS_DOCKED
                ||    eDBS == CExtDynamicControlBar::__EDBS_FLOATING
                )
            )
            BarStateSet( eDBS, false );
    }
 
    CExtControlBar::NcButtons_PostClick(
        pNcAreaButton,
        point,
        pBarEventSource,
        pBarActiveInContainer
        );
}