![]() |
CXTPSyntaxEditCtrl ScrollBar problem |
Post Reply
|
| Author | |
Italo
Groupie
Joined: 10 December 2003 Location: United States Status: Offline Points: 83 |
Post Options
Thanks(0)
Quote Reply
Topic: CXTPSyntaxEditCtrl ScrollBar problemPosted: 05 January 2007 at 2:36pm |
|
RecalcScrollBars is causing the scrollbar to show and hide at the same call, which in turn is causing the control to be repainted and the scrollbar to flicker. This can be avoided by doing the following: Replace RecalcScrollBars with the code below void CXTPSyntaxEditCtrl::RecalcScrollBars() { if (!XTPSyntaxEditPaintManager()->GetFont()->GetSafeHandle()) return; // create scroll bar info SCROLLINFO info; ZeroMemory(&info, sizeof(SCROLLINFO)); int nTopRow = m_nTopCalculatedRow = GetDocumentRow(1); int nBottomRow = m_nBottomCalculatedRow = GetDocumentRow(GetRowPerPage()); int iMax = m_pBuffer->CalcMaxLineTextLength(nTopRow, nBottomRow); int nVisRows = GetVisibleRowsCount(); int iPageX = 20, iPageY = 20; if (::IsWindow(m_hWnd)) { CXTPClientRect rcWnd(this); iPageX = rcWnd.Width() / m_tm.tmAveCharWidth; iPageY = rcWnd.Height() / m_tm.tmHeight; iMax += iPageX/2; } if (GetRowCount() <= 0) { GetScrollInfo(SB_VERT, &info); info.cbSize = sizeof(info); info.fMask = SIF_DISABLENOSCROLL | SIF_PAGE; info.nPage = iPageY; SetScrollInfo(SB_VERT, &info); EnableScrollBarCtrl(SB_VERT); GetScrollInfo(SB_HORZ, &info); info.nMax = iMax; info.nPage = iPageX; info.fMask = SIF_DISABLENOSCROLL | SIF_PAGE; SetScrollInfo(SB_HORZ, &info); } else { GetScrollInfo(SB_HORZ, &info); int nMaxRowInPage = GetRowPerPage(); info.nMax = iMax; info.nPage = iPageX; info.fMask = SIF_DISABLENOSCROLL | SIF_PAGE | SIF_POS | SIF_RANGE; SetScrollInfo(SB_HORZ, &info); EnableScrollBarCtrl( SB_HORZ ); GetScrollInfo(SB_VERT, &info); info.nPage = iPageY; BOOL bVertScrl = (nVisRows >= nMaxRowInPage); if (bVertScrl) { info.nMin = 1; info.nMax = nVisRows; info.fMask = SIF_DISABLENOSCROLL | SIF_PAGE | SIF_POS | SIF_RANGE; SetScrollInfo(SB_VERT, &info); } EnableScrollBarCtrl(SB_VERT, bVertScrl); } CalculateEditbarLength(); |
|
![]() |
|
sserge
Moderator Group
Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
Quote Reply
Posted: 08 January 2007 at 7:24am |
|
Thanks, we'll update it.
-- WBR, Serge |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |