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 » my dialog causes application hang if dragging dialog title bar, using skin library of version 2.88 Collapse All
Subject Author Date
HP Jiang Mar 5, 2010 - 12:05 AM

hi,

my dialog class is inherited from public CExtNCW<CExtResizableDialog>.
and my application is built with the skin library of version 2.88. it’s a MDI application.

After popping up a dialog in my application, dragging the dialog title bar sometimes causes my application hang, then exit automatically.
I am using the BlackDiamond.Skin.

anybody has the same problem as mine?

thanks

Searoc


Technical Support Mar 9, 2010 - 8:38 AM

If the dialog window hangs forever, then you can attach the debugger, break the application execution and take a look at the call stack to clarify what’s wrong. You can also use the SPY++ utility application to see what’s happen when the dragged dialog hangs. You should spy all the messages of your application in SPY++. We suspect some subsystem in your application overloads the UI thread’s message queue with too much messages.

HP Jiang Mar 10, 2010 - 8:08 PM

thank you for your help.


I made some tests, and below is the result:


1.  I created a Grid inside my Control bar, this Grid is CExtNSB < CFilteredGridWnd >  m_wndFilteredGrid;


     after drag any other Dialogs on top of this controlbar quickly, my application cpu usage increases to 99%, it seems redraw somthing.


     class CFilteredGridWnd : public CThemedGrid


2. another test: dragging a dialog containing a Grid inherited from CThemedGrid several times and moving quickl, my application cpu usage increases to 99%, it seems redraw somthing.


code of CThemedGrid is in below, which is actually from your example.




    class CThemedGrid : public CExtGridWnd

    {

        DECLARE_DYNAMIC(CThemedGrid)



    public:

        CThemedGrid();

        virtual ~CThemedGrid();



        virtual void OnSiwPaintBackground(CDC & dc, bool bFocusedControl) const;

        //virtual void OnSiwPaintForeground(

        //    CDC & dc,

        //    bool bFocusedControl

        //    ) const;



    protected:

        DECLARE_MESSAGE_MAP()

    private:

        int m_nBkType;

        static CBitmap g_bmpBk;

        static CSize g_sizeBmpBk;

    };




    CBitmap CThemedGrid::g_bmpBk;

    CSize CThemedGrid::g_sizeBmpBk( 0, 0 );



    IMPLEMENT_DYNAMIC(CThemedGrid,  CExtGridWnd)



    CThemedGrid::CThemedGrid():m_nBkType(1)//1: get the global painter 2: get outside from dialog maybe

    {

        if( g_bmpBk.GetSafeHandle() == NULL )

        {

            if( g_bmpBk.LoadBitmap( IDB_BITMAP_GRID_BK_IMAGE ) )

            {

                ASSERT( g_bmpBk.GetSafeHandle() != NULL );

                BITMAP bmpInfo;

                ::memset( &bmpInfo, 0, sizeof(BITMAP) );

                g_bmpBk.GetBitmap( &bmpInfo );

                g_sizeBmpBk.cx = bmpInfo.bmWidth;

                g_sizeBmpBk.cy = bmpInfo.bmHeight;

                ASSERT( g_sizeBmpBk.cx > 0 && g_sizeBmpBk.cy > 0 );

            }

        } // if( g_bmpBk.GetSafeHandle() == NULL )

    }



    CThemedGrid::~CThemedGrid()

    {

    }





    BEGIN_MESSAGE_MAP(CThemedGrid,  CExtGridWnd )

    END_MESSAGE_MAP()





    void CThemedGrid::OnSiwPaintBackground(CDC & dc, bool bFocusedControl) const

    {

        ASSERT_VALID( this );

        CExtGridWnd :: OnSiwPaintBackground( dc, bFocusedControl );

        if( m_nBkType == 0 )

            return;

        CRect rcGridInner = OnSwGetClientRect();

        if( ! dc.RectVisible( &rcGridInner ) )

            return;

        if( m_nBkType == 1 )

        {

            bool bFillArea = true;

            if( g_PaintManager->GetCb2DbTransparentMode( (CWnd*)this ) )

            {

                if( g_PaintManager->PaintDockerBkgnd( true, dc, (CWnd*)this ) )

                    bFillArea = false;

            } // if( g_PaintManager->GetCb2DbTransparentMode( (CWnd*)this ) )

            if( bFillArea )

            {

                COLORREF clrFill =

                    g_PaintManager->GetColor( CExtPaintManager::CLR_3DFACE_OUT, (CObject*)this );

                dc.FillSolidRect( &rcGridInner, clrFill );

            } // if( bFillArea )

        } // if( m_nBkType == 1 )

        else if( m_nBkType == 2 )

        {

            if( g_bmpBk.GetSafeHandle() != NULL )

            {

                ASSERT( g_sizeBmpBk.cx > 0 && g_sizeBmpBk.cy > 0 );

                CDC dcSrc;

                if( dcSrc.CreateCompatibleDC(&dc) )

                {

                    CBitmap * pBmpOld = dcSrc.SelectObject( &g_bmpBk );

                    CSize sizeGridInner = rcGridInner.Size();

                    int nStepCountX = sizeGridInner.cx / g_sizeBmpBk.cx;

                    if( (sizeGridInner.cx % g_sizeBmpBk.cx) != 0 )

                        nStepCountX ++;

                    int nStepCountY = sizeGridInner.cy / g_sizeBmpBk.cy;

                    if( (sizeGridInner.cy % g_sizeBmpBk.cy) != 0 )

                        nStepCountY ++;

                    for( int nStepX = 0; nStepX < nStepCountX; ++nStepX )

                    {

                        for( int nStepY = 0; nStepY < nStepCountY; ++nStepY )

                        {

                            dc.BitBlt(

                                rcGridInner.left + nStepX*g_sizeBmpBk.cx,

                                rcGridInner.top + nStepY*g_sizeBmpBk.cy,

                                g_sizeBmpBk.cx,

                                g_sizeBmpBk.cy,

                                &dcSrc,

                                0,

                                0,

                                SRCCOPY

                                );

                        } // for( int nStepY = 0; nStepY < nStepCountY; ++nStepY )

                    } // for( int nStepX = 0; nStepX < nStepCountX; ++nStepX )

                    dcSrc.SelectObject( pBmpOld );

                } // if( dcSrc.CreateCompatibleDC(&dc) )

            } // if( g_bmpBk.GetSafeHandle() != NULL )

        } // else if( m_nBkType == 2 )

    }


any idea?

Technical Support Mar 11, 2010 - 7:35 AM

The CPU eating issue is definitively hidden somewhere outside the source code from your message. Could you please create a simple test project reproducing this CPU eating issue and send it to the support mail box at this web site?

HP Jiang Mar 14, 2010 - 8:42 PM

I found the problem lied in the CExtToolControlBar working with the CExtControlBar.


First of all, my class CScenarioPanel : public CExtNCW<CExtResizableDialog>,


and a CExtToolControlBar toolbar is put in the CScenarioPanel. In my MDI applicaiton,  CScenarioPanel is created inside of the CExtControlBar. pls see picture attached here.


CExtToolControlBar caused this cpu eating problem, since that problem is gone after I repalced it with individual buttons.


some code is listed in below to show my way to instance the toolbar of CExtToolControlBar


void CScenarioPanel::DoDataExchange(CDataExchange* pDX)

{

.....

    DDX_Control(pDX, IDR_TB_SCENARIO, lv_ToolBar);


....


}

BOOL CScenarioPanel::OnInitDialog()

{

    CExtNCW<CExtResizableDialog>::OnInitDialog();

        if( !lv_ToolBar.LoadToolBar( IDR_TB_SCENARIO )    )

        {

            TRACE0( "Failed to create toolbar" );

            return -1;

        }


RepositionBars(0, 0xFFFF, IDC_SCENARIO_LIST);//IDC_SCENARIO_LIST is the ID of the Grid below the Toolbar.


...

}

BTW, if I use RepositionBars(0, 0xFFFF, 0); the applciation crashes at the initialization stage.

1.bp.blogspot.com/_V4iDvQZiP7g/S52cC23-QHI/AAAAAAAAFGo/v80k7v7B2RQ/s1600-h/problem.jpg

Technical Support Mar 15, 2010 - 10:44 AM

We have a lot of toolbars inside resizable control bars in the ProfStudio sample application. But we never faced CPU over usage and repositioning crash problems. We suspect these issue can depend on some of your command updating methods or OnCmdMsg() virtual methods. Could you please show us the call stack at the crash time?

HP Jiang Mar 7, 2010 - 6:51 PM

I don’t use any timer and overidding OnIdle().

Technical Support Mar 5, 2010 - 10:22 AM

Do you use any heavy code invoked on timers or during the idle time processing (overridden OnIdle() virtual method)?