Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-08

Fix for broken scrollbar in lhelp (fix in turbopower_ipro)

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd Kreuss

I have a fix for turbopower_ipro that will also fix the totally broken scrollbar behavior of lhelp on GTk2 and probably also other widgetsets.

attached is the diff file, it fixes just one line of code in IpHtml.pas.

here is some part of the code from TIpHtmlScrollBar.ScrollMessage() as it looks now after the fix, I have inserted as a comment the line that was there previously. The fact that it worked on windows was a pure coincidence, on windows there will never be a SB_THUMBPOSITION message, the code in question will never be executed. On windows there will only be SB_THUMBTRACK while on GTK2 there will be both messages.

Doing these odd things with FIncrement during a message that is supposed to give me the *absolute* position of the scrollbar results in the strange behavior of crazy jumping scroll position. This line might have been some cut&paste accident, the wrong indedation of this line might be evidence for this.

The correct way of handling the message must be SetPosition(Pos). The attached patch will correct this and after recompiling the lhelp example the chm-viwer lhelp will work correctly on linux GTK2.

here is the code snippet discussed above:

  with Msg do
    case ScrollCode of
    SB_LINEUP:
      SetPosition(FPosition - FIncrement);
    SB_LINEDOWN:
      SetPosition(FPosition + FIncrement);
    SB_PAGEUP:
      SetPosition(FPosition - ControlSize(True, False));
    SB_PAGEDOWN:
      SetPosition(FPosition + ControlSize(True, False));
    SB_THUMBPOSITION:
      if FCalcRange > 32767 then
        SetPosition(GetRealScrollPosition)
      else
        //  this is plain wrong:
        //  SetPosition( FPosition + (Pos - FPosition) * FIncrement );
        SetPosition(Pos);
    SB_THUMBTRACK:
      if Tracking then
        if FCalcRange > 32767 then
          SetPosition(GetRealScrollPosition)
        else
          SetPosition(Pos);
    SB_TOP:
      SetPosition(0);
    SB_BOTTOM:
      SetPosition(FCalcRange);
    SB_ENDSCROLL:
      ;
    end;

and attached you find the patch for IpHtml.pas. Apply it against currrent svn version from within the trunk/ directory, then recompile lhelp and enjoy flawlessly working chm help under gtk2.

Bernd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ippro-fix-broken-scrollbar-behavior.diff
Type: text/x-diff
Size: 582 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100801/c9692b67/attachment.bin>

Reply by email

Bernd Kreuss
to Bernd Kreuss

On 01.08.2010 17:40, Bernd Kreuss wrote:

[3 times the same]

sorry for posting it 3 times, thunderbird gave me a fatal SMTP error and left the window open so i didn't expect that it had gone through.

Reply by email

Žilvinas Ledas
to Bernd Kreuss: I have a fix for turbopower_ipro that will also fix the totally broken scrollbar behavior…

I suggest you add it to the bug tracker.

BTW, I saw this bug in GTK2 and was going to look at it in a few weeks, so it is good for me that you fixed it. Thanks ;)

Regards
?ilvinas

Bernd Kreuss wrote 5 lines
t the line that was there previously. The fact that it worked on windows was a pure coincidence, on windows there will never be a SB_THUMBPOSITION message, the code in question will never be executed. On windows there will only be SB_THUMBTRACK while on GTK2 there will be both messages.

Reply by email

Andrew Haines
to Bernd Kreuss: I have added it here: http://bugs.freepascal.org/view.php?id=17081 I hope this is the…
Bernd Kreuss wrote 11 lines
On 01.08.2010 18:01, ?ilvinas Ledas wrote: > I suggest you add it to the bug tracker. I have added it here: http://bugs.freepascal.org/view.php?id=17081 I hope this is the correct place. i didn't find an existing bug report and the section "Lazarus >> patches" seemed to be meant for spontaneous patches (judging from the other things that are filed there). --

I applied your patch, thanks for it.

Regards,

Andrew

Reply by email