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 » How can I destroy CExtDynamicControlBar on close window button click? Collapse All
Subject Author Date
Gevork Odabashyan Dec 27, 2006 - 1:29 AM

I need some of my dynamic control bars to be destroyed on close window button click, and to keep standard behavior (hide) to others. Tell me please how can I do this?
I’v overridden BarStateSet() method, in which I close dynamic control bar by calling BarFree() and returnig false as a result. This manner worked till 2.62 version has been released. In version 2.62 the result of BarStateSet() call is ignored in CExtDynamicControlBar::NcButtons_PostClick() method and CExtControlBar::NcButtons_PostClick() is always called while I’ve already destroyed this control bar.
Is my solution correct or I need to do something else?

Offer Har Dec 29, 2006 - 8:12 AM

Dear Support,
How can i get the version 2.63.2?
Regards,
Ron.

Offer Har Dec 28, 2006 - 5:10 AM

Dear Gevork,
I was facing the same problem, and could not find a good solution - my problem was when having few bars tabbed, or side-by-side.
Did you try it in one of these methods? did the application work properly?
Thanks,
Ron.

Technical Support Dec 27, 2006 - 1:37 PM

Here is the final part of the CExtDynamicBarNcAreaButtonClose::OnNcAreaClicked() method:

    if( pBar != NULL )
        pBar->BarStateSet( pBar->BarStateGet(), false );
    if(    hWndBar != NULL
        && ::IsWindow( hWndBar )
        )
        pExtBar->NcButtons_PostClick( this, point, pExtBar, NULL );
    return true;
As you can see CExtDynamicControlBar::NcButtons_PostClick() should not be invoked if the CExtDynamicControlBar::BarStateSet() method destroys the CExtDynamicControlBar window.

We added the following method to the CSimpleControlBar class in the SDI_DynamicBars sample in order to so demonstrate how to destroy dynamic control bars correctly:
    virtual bool BarStateSet(
        eDynamicBarState_t eDBS,
        bool bShow
        )
    {
        if( bShow )
            return CExtDynamicControlBar::BarStateSet( eDBS, bShow );
        GetBarSite()->BarFree( this );
        return false;
    }


Gevork Odabashyan Dec 28, 2006 - 12:58 AM

Thanks. But where can I download this sample? I’ve downloaded the 2.631 version but I cannot find it.

Technical Support Dec 29, 2006 - 4:54 AM

We have not yet uploaded 2.63.2, so just open SDI_DynamicBars sample in Visual Studio, find the CSimpleControlBar class in MainFrm.h and insert the following method into the class declaration:

virtual bool BarStateSet(
        eDynamicBarState_t eDBS,
        bool bShow
        )
    {
        if( bShow )
            return CExtDynamicControlBar::BarStateSet( eDBS, bShow );
        GetBarSite()->BarFree( this );
        return false;
    }