Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPSyntaxEditCtrl ScrollBar problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPSyntaxEditCtrl ScrollBar problem

 Post Reply Post Reply
Author
Message
Italo View Drop Down
Groupie
Groupie


Joined: 10 December 2003
Location: United States
Status: Offline
Points: 83
Post Options Post Options   Thanks (0) Thanks(0)   Quote Italo Quote  Post ReplyReply Direct Link To This Post Topic: CXTPSyntaxEditCtrl ScrollBar problem
    Posted: 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();

}
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2007 at 7:24am
Thanks, we'll update it.

--
WBR,
Serge
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.