Print Page | Close Window

Ribbon Sample

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=6990
Printed Date: 12 November 2025 at 5:38pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Ribbon Sample
Posted By: BastianPL
Subject: Ribbon Sample
Date Posted: 26 April 2007 at 10:01am
Hi,
 
I have problem. In ribobn sample application, when I am rezising window, the scrollricheditview is flickering very much. How can I change this to make that witout flickering ??

Thanks


-------------
Bastian



Replies:
Posted By: BastianPL
Date Posted: 26 April 2007 at 12:19pm
Hi,
 
I have also problem with CXTButton added to status bar. In this same status bar i have a second pane that shows current cursor position.
My button is declared as CXTPNoFlickerWnd<CXTButton> m_wndStatusButton. And when I am moving mouse the button is flickering.


If anybody have any ideas i would be appreviative for help.
 
Thanks


-------------
Bastian


Posted By: Oleg
Date Posted: 27 April 2007 at 1:01am
Hi,
 
Strange, may be you already modified sample somehow, I don't see flickers at all :(


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


Posted By: BastianPL
Date Posted: 27 April 2007 at 5:28am
Hi,
 
It doesn't help. My code is very simple.When I am resizing windows a view inside Workspace view still flickers. I didn't change code very much. Just instead your CScrollRichEdit class I am using normal CView class.
 

void CMainView::OnPaint()

{

    CPaintDC dc( this );

    CRect rc;

    GetClientRect( &rc );

    CXTMemDC MemoryDC( &dc, &rc );

    rc.DeflateRect( 16, 16, 16, 16 );

    MemoryDC.FillSolidRect( &rc, RGB( 255, 0, 0 ) );

}

 

BOOL CMainView::OnEraseBkgnd( CDC *pDC )

{

    return TRUE;

}


Thanks for help.
Sebastian


-------------
Bastian


Posted By: BastianPL
Date Posted: 04 May 2007 at 10:57am

Do You have some ideas ???

 
Thanks


-------------
Bastian


Posted By: BastianPL
Date Posted: 04 May 2007 at 11:22am
I just send You all my header and cpp. The workspace class is this same like in ribbon sample.
 
Thanks a lot for your help!
 
my Header
 

#pragma once

#include "TestView.h"

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

class CMainDoc;

class CMainView : public CView

{

protected:

CMainView();

DECLARE_DYNCREATE( CMainView )

// Attributes

public:

CMainDoc* GetDocument();

virtual ~CMainView();

// Operations

public:

virtual BOOL PreCreateWindow( CREATESTRUCT& cs );

#ifdef _DEBUG

virtual void AssertValid() const;

virtual void Dump( CDumpContext& dc ) const;

#endif

virtual void CalcWindowRect( LPRECT lpClientRect, UINT nAdjustType = adjustBorder );

protected:

// called first time after construct

virtual void OnInitialUpdate();

virtual BOOL OnPreparePrinting( CPrintInfo *pInfo );

afx_msg void OnDestroy();

afx_msg BOOL OnEraseBkgnd( CDC *pDC );

DECLARE_MESSAGE_MAP()

void OnEmptyCommand( UINT );

virtual void OnDraw( CDC* /*pDC*/ );

afx_msg void OnPaint();

afx_msg void OnNcPaint();

public:

afx_msg void OnMouseMove(UINT nFlags, CPoint point);

protected:

virtual void OnUpdate(CView* /*pSender*/, LPARAM /*lHint*/, CObject* /*pHint*/);

HBITMAP hBitmap;

public:

afx_msg void OnSize(UINT nType, int cx, int cy);

};

My CPP

#include "stdafx.h"

#include "CMainApp.h"

#include "CMainDoc.h"

#include "CMainView.h"

#include "CMainFrame.h"

#include "CWorkspaceView.h"

#include "CDoubleBuffer.h"

#ifdef _DEBUG

#define new DEBUG_NEW

#undef THIS_FILE

static char THIS_FILE[] = __FILE__;

#endif

/*************************************************************************************************************************************************************\

*

* Message maps

*

* DESCRIPTION:

* Message maps

*

\*************************************************************************************************************************************************************/

IMPLEMENT_DYNCREATE( CMainView, CView )

BEGIN_MESSAGE_MAP( CMainView, CView )

ON_WM_DESTROY()

ON_WM_MOUSEMOVE()

ON_WM_PAINT()

ON_WM_ERASEBKGND()

ON_WM_NCPAINT()

ON_WM_SIZE()

END_MESSAGE_MAP()

/*************************************************************************************************************************************************************\

*

* CAlphabetNamesView()

*

* DESCRIPTION:

* Constructor

*

\*************************************************************************************************************************************************************/

CMainView::CMainView()

{

hBitmap = (HBITMAP)::LoadImage( NULL, "C:\\test.bmp", IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE );

}

/*************************************************************************************************************************************************************\

*

* ~CAlphabetNamesView()

*

* DESCRIPTION:

* Destructor

*

\*************************************************************************************************************************************************************/

CMainView::~CMainView()

{

}

/*************************************************************************************************************************************************************\

*

* BOOL PreCreateWindow( CREATESTRUCT& cs )

*

* DESCRIPTION:

* Precreate window style

*

\*************************************************************************************************************************************************************/

BOOL CMainView::PreCreateWindow( CREATESTRUCT& cs )

{

cs.dwExStyle &= ~WS_EX_CLIENTEDGE;

return CView::PreCreateWindow( cs );

}

/*************************************************************************************************************************************************************\

*

* void OnInitialUpdate()

*

* DESCRIPTION:

* Initial update on view. Called only once

*

\*************************************************************************************************************************************************************/

void CMainView::OnInitialUpdate()

{

CView::OnInitialUpdate();

ModifyStyleEx( WS_EX_CLIENTEDGE , 0 );

ModifyStyle( 0, WS_BORDER );

ULONG ulStyle = ::GetClassLong( GetSafeHwnd(), GCL_STYLE );

if( !( ulStyle & CS_DROPSHADOW ) )

::SetClassLong( GetSafeHwnd(), GCL_STYLE, CS_DROPSHADOW );

}

/*************************************************************************************************************************************************************\

*

* void OnPreparePrinting( CPrintInfo *pInfo )

*

* DESCRIPTION:

* Prepare printing

*

\*************************************************************************************************************************************************************/

BOOL CMainView::OnPreparePrinting( CPrintInfo *pInfo )

{

// default preparation

return DoPreparePrinting( pInfo );

}

/*************************************************************************************************************************************************************\

*

* void OnDestroy( )

*

* DESCRIPTION:

* Destroy view

*

\*************************************************************************************************************************************************************/

void CMainView::OnDestroy()

{

CView::OnDestroy();

}

#ifdef _DEBUG

/*************************************************************************************************************************************************************\

*

* void AssertValid( ) const

*

* DESCRIPTION:

* Assert

*

\*************************************************************************************************************************************************************/

void CMainView::AssertValid() const

{

CView::AssertValid();

}

/*************************************************************************************************************************************************************\

*

* void Dump( CDumpContext& dc ) const

*

* DESCRIPTION:

* Dump

*

\*************************************************************************************************************************************************************/

void CMainView::Dump( CDumpContext& dc ) const

{

CView::Dump( dc );

}

/*************************************************************************************************************************************************************\

*

* CAlphabetNamesDoc* CAlphabetNamesView::GetDocument()

*

* DESCRIPTION:

* Return document object pointer

*

\*************************************************************************************************************************************************************/

CMainDoc* CMainView::GetDocument()

{

ASSERT( m_pDocument->IsKindOf( RUNTIME_CLASS( CMainDoc ) ) ) ;

return (CMainDoc *)m_pDocument;

}

#endif //_DEBUG

/*************************************************************************************************************************************************************\

*

* void OnDraw ( CDC *pDC )

*

* DESCRIPTION:

* View drawing function

*

\*************************************************************************************************************************************************************/

void CMainView::OnDraw( CDC *pDC )

{

return;

}

/*************************************************************************************************************************************************************\

*

* void CalcWindowRect( LPRECT lpClientRect, UINT nAdjustType )

*

* DESCRIPTION:

* Calculates window rect

*

\*************************************************************************************************************************************************************/

void CMainView::CalcWindowRect( LPRECT lpClientRect, UINT nAdjustType )

{

CView::CalcWindowRect( lpClientRect, nAdjustType );

int nWidth = 200;

int nHeight = 200;;

int nClientWidth = lpClientRect->right - lpClientRect->left;

int nBorders = max(8, nClientWidth - nWidth);

int nTopMargin = max(4, 40);

lpClientRect->top += nTopMargin;

lpClientRect->left += 300;

lpClientRect->right -= 300;

lpClientRect->bottom -= 30;

}

/*************************************************************************************************************************************************************\

*

* void OnMouseMove( UINT nFlags, CPoint point )

*

* DESCRIPTION:

* WM_MOUSEMOVE message handler

*

\*************************************************************************************************************************************************************/

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

{

CString cs;

cs.Format( "X=%.3d : Y=%.3d", point.x, point.y );

CMainFrame* pFrame = (CMainFrame *)AfxGetMainWnd();

if ( pFrame )

{

pFrame->m_wndStatusBar.SetPaneText( pFrame->m_wndStatusBar.CommandToIndex( ID_INDICATOR_POSITION ), cs, TRUE );

}

CView::OnMouseMove(nFlags, point);

}

/*************************************************************************************************************************************************************\

*

* void OnUpdate( CView *pSender, LPARAM lHint, CObject *pHint )

*

* DESCRIPTION:

* OnUpdate view function called by document object

*

\*************************************************************************************************************************************************************/

void CMainView::OnUpdate( CView *pSender, LPARAM lHint, CObject *pHint )

{

int nParam = (int)lHint;

//if ( nParam == 1 )

// m_strFileName = *(CString *)pHint;

}

/*************************************************************************************************************************************************************\

*

* void OnPaint()

*

* DESCRIPTION:

* OnPaint message handler

*

\*************************************************************************************************************************************************************/

void CMainView::OnPaint()

{

CPaintDC dc( this );

CXTPWindowRect rc( this );

//GetClientRect( &rcClient );

ScreenToClient( &rc );

CXTMemDC memDC( &dc, &rc );

rc.DeflateRect( 20, 20, 20, 20 );

memDC.FillSolidRect( &rc, RGB( 255, 0, 0 ) );

}

 

/*************************************************************************************************************************************************************\

*

* void OnEraseBkgnd( CDC *pDC )

*

* DESCRIPTION:

* WM_ERASEBKGND message handler

*

\*************************************************************************************************************************************************************/

BOOL CMainView::OnEraseBkgnd( CDC *pDC )

{

return TRUE;

}

/*************************************************************************************************************************************************************\

*

* void OnNcPaint()

*

* DESCRIPTION:

* OnNcPaint message handler

*

\*************************************************************************************************************************************************************/

void CMainView::OnNcPaint()

{

CView::OnNcPaint();

}

 

/*************************************************************************************************************************************************************\

*

* void OnSize( UINT nType, int cx, int cy )

*

* DESCRIPTION:

* WM_SIZE method

*

\*************************************************************************************************************************************************************/

void CMainView::OnSize( UINT nType, int cx, int cy )

{

CView::OnSize( nType, cx, cy );

}



-------------
Bastian


Posted By: Oleg
Date Posted: 04 May 2007 at 2:56pm
Hello,
 
Attach whole project in issuetrack.


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



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