#423 Fix for scrollbar flicker

Core (49)
Eric Grange

When moving the cursor, the scrollbars can flicker

The Issue is in TCustomSynEdit.UpdateScrollBars, where EnableScrollBar can be called twice, fix by changing the code to

if (LeftChar <= 1) then
EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_LEFT)
else if iRightChar >= nMaxScroll then
EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_RIGHT)
else EnableScrollBar(Handle, SB_HORZ, ESB_ENABLE_BOTH);

and similarly for the vertical scrollbar


  • Bas Schouten

    Bas Schouten - 2011-10-03

    I can alter the code, but cannot test at the moment...

    The original code segment you're referencing starts with a
    EnableScrollBar(Handle, SB_VERT, ESB_ENABLE_BOTH);

    Should this line stay there? That way EnableScrollBar still will be called twice in the latest else-clause, wouldnt it?

  • Eric Grange

    Eric Grange - 2011-10-04

    After some more testing, that's an incorrect fix, sometimes the scrollbar don't get updated. The flickering is caused by a windows bug with scrollbar animations apparently.

    The only way I could fix it was by using LockWindowUpdate, which is a little dirty, but WM_SETREDRAW didn't cut it (would require way more changes, and might break many things)


    if (fScrollBars in [ssBoth, ssHorizontal]) and not WordWrap then
    ... (two big if in between one for horizontal, the other for vertical scrollbars)
    EnableScrollBar(Handle, SB_VERT, ESB_ENABLE_BOTH);


    Might want to protect those with a try..finally, though it shouldn't be necessary strictly speaking unless there is a bug in the scrollbar code.

  • Bas Schouten

    Bas Schouten - 2011-10-04

    Can you attach the altered SynEdit.Pas to this issue?
    I'll will check it in

  • Eric Grange

    Eric Grange - 2011-10-04
  • Eric Grange

    Eric Grange - 2011-10-04

    Attached, there are a couple other lines changed you may want to ignore (the SVN tag, a disabled warning...)

  • Bas Schouten

    Bas Schouten - 2011-10-04
    • status: open --> closed-fixed
  • Bas Schouten

    Bas Schouten - 2011-10-04

    [Canned response]
    This bug has been fixed in the latest stable release.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks