Print Page | Close Window

CXTSplitterWnd Flicker issue

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Visual C++ MFC
Forum Description: Topics related to Codejock Visual C++ MFC products
URL: http://forum.codejock.com/forum_posts.asp?TID=11300
Printed Date: 24 November 2024 at 11:11am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTSplitterWnd Flicker issue
Posted By: brutuscat
Subject: CXTSplitterWnd Flicker issue
Date Posted: 03 July 2008 at 7:30pm
Hi!
I'm using the CXTSplitterWnd and the Views are flickering A LOT!

I'm with the 1200 version, on VS2005 and WinXP SP2.

I'm appending CDialog controls inside my views (CView) and both (the CDialogs and the CViews) are being templated trought the CXTPNoFlickerWnd template class.
Inside the CDialogs also live other child dialogs, with other controls.
The CView derived class, calls to MoveWindow of the child CDialogs as a basic logic for the splitter (just for now).
Also I'm applying the fix for the Splitter related with the OnMouseMove and OnLButtonUp issues.
This how I'm initializin the controls:

     if(_splitter == NULL)
          _splitter = new CGdxSplitterWndFixed;
     _splitter->CreateStatic(_frameContainer,2, 1);
     _splitter->ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
     //_splitter->SetSplitterStyle(XT_SPLIT_DOTTRACKER);
     _splitter->CreateView(0,0, RUNTIME_CLASS(CHolderView), CSize(rect.Width(), rect.Height()/2), &ccc);
     CHolderView* pView = (CHolderView*)_splitter->GetPane(0,0);
     ASSERT_VALID(pView);
     if(_report == NULL)
          _report = new CXTPNoFlickerWnd<CGdxReportViewDialog>;
     pView->setWnd(_report);
     pView->setOwner(parent);
     _report->Create(CGdxReportViewDialog::IDD, pView);

and then the show thing with the EnableThemeDialogTexture

_report->ShowWindow(SW_SHOW);
_frameContainer->ShowWindow(SW_SHOW);
_splitter->ShowWindow(SW_SHOW);
XTPSkinManager()->EnableThemeDialogTexture(_report->GetSafeHwnd(), ETDT_ENABLE);     

and so...

How can avoid the Flickering?

Thanks!




Replies:
Posted By: Oleg
Date Posted: 04 July 2008 at 1:24am
Hi,
 
in Views catch WM_ERASEBGND and return TRUE, add WS_CLIPCHILDREN for Views and Splitter.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: brutuscat
Date Posted: 04 July 2008 at 1:46pm
No, no luck.
I added the WS_CLIPCHILDREN to the splitter and to the CViews, also to the parent frame of the splitter.
Almost all child windows of the splitter are templated using the CXTPNoFlickerWnd, which returns TRUE in the WM_ERASEBGND.
Maybe you can send me an example using CDialogs inside the splitter that doesn't flicker?

Thanks!


Posted By: bschaer
Date Posted: 25 August 2008 at 12:33pm

Oleg,

 
I posted comments about CXTSplitterWnd in the Beta group quite some time ago and it seems that nothing has been changed thru 12.0.2
 
OnLButtonUp should be deleted entirely or forwarded to CSplitterWnd, and OnMouseMove should be simplified as shown below.
 

void CXTSplitterWnd::OnLButtonUp(UINT nFlags, CPoint point)

{

CSplitterWnd::OnLButtonUp(nFlags, point);

// Invalidate();

}

void CXTSplitterWnd::OnMouseMove(UINT nFlags, CPoint point)

{

CSplitterWnd::OnMouseMove(nFlags, point);

if(m_bTracking && m_bFullDrag && m_point != point)

{

OnLButtonUp(MK_LBUTTON, point);

OnLButtonDown(MK_LBUTTON, point);

RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW);

m_point = point;

}

}



Posted By: znakeeye
Date Posted: 09 October 2008 at 4:45pm
Any news? Is this fixed in 12.1?


Posted By: Oleg
Date Posted: 10 October 2008 at 2:02am
We didn't confirmed this problem.

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: zitz
Date Posted: 02 March 2009 at 8:22am
Need remove:

OnLButtonUp(MK_LBUTTON, point);

OnLButtonDown(MK_LBUTTON, point);

Anyway it does not work correctly.

i patch it that:
void CXTSplitterWnd::OnMouseMove( UINT nFlags, CPoint point )
{
    if ( m_bFullDrag == FALSE )
    {
        CSplitterWnd::OnMouseMove( nFlags, point );
        return;
    }

    if ( GetCapture() != this )
    {
        StopTracking( FALSE );
    }

    if ( m_bTracking )
    {
        // move tracker to current cursor position
        point.Offset(m_ptTrackOffset); // point is the upper right of hit detect

        // limit the point to the valid split range
        if (point.y < m_rectLimit.top)
        {
            point.y = m_rectLimit.top;
        }
        else if (point.y > m_rectLimit.bottom)
        {
            point.y = m_rectLimit.bottom;
        }
        if (point.x < m_rectLimit.left)
        {
            point.x = m_rectLimit.left;
        }
        else if (point.x > m_rectLimit.right)
        {
            point.x = m_rectLimit.right;
        }

        if (m_htTrack == vSplitterBox || m_htTrack >= vSplitterBar1 && m_htTrack <= vSplitterBar15)
        {
            if (m_rectTracker.top != point.y)
            {
                OnInvertTracker(m_rectTracker);
                m_rectTracker.OffsetRect(0, point.y - m_rectTracker.top);
                OnInvertTracker(m_rectTracker);
            }
        }
        else if (m_htTrack == hSplitterBox || m_htTrack >= hSplitterBar1 && m_htTrack <= hSplitterBar15)
        {
            if (m_rectTracker.left != point.x)
            {
                OnInvertTracker(m_rectTracker);
                m_rectTracker.OffsetRect(point.x - m_rectTracker.left, 0);
                OnInvertTracker(m_rectTracker);
            }
        }
        else if (m_htTrack == bothSplitterBox || (m_htTrack >= splitterIntersection1 && m_htTrack <= splitterIntersection225))
        {
            if (m_rectTracker.top != point.y)
            {
                OnInvertTracker(m_rectTracker);
                m_rectTracker.OffsetRect(0, point.y - m_rectTracker.top);
                OnInvertTracker(m_rectTracker);
            }
            if (m_rectTracker2.left != point.x)
            {
                OnInvertTracker(m_rectTracker2);
                m_rectTracker2.OffsetRect(point.x - m_rectTracker2.left, 0);
                OnInvertTracker(m_rectTracker2);
            }
        }

        int htTrack = m_htTrack;
        StopTracking( TRUE );
        StartTracking( htTrack );

        if (m_point != point)
        {
            RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW);
            m_point = point;
        }
    }
    else
    {
        // simply hit-test and set appropriate cursor
        int ht = HitTest(point);
        SetSplitCursor(ht);
    }
}




Posted By: znakeeye
Date Posted: 17 May 2010 at 6:50am

Have you tested this with this setting enabled/disabled?

SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 0, (PVOID)FALSE, SPIF_SENDCHANGE);
vs
SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 0, (PVOID)TRUE, SPIF_SENDCHANGE);


-------------
PokerMemento - http://www.pokermemento.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net