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
Index: components/turbopower_ipro/iphtml.pas
===================================================================
--- components/turbopower_ipro/iphtml.pas	(Revision 26963)
+++ components/turbopower_ipro/iphtml.pas	(Arbeitskopie)
@@ -17768,7 +17768,7 @@
       if FCalcRange > 32767 then
         SetPosition(GetRealScrollPosition)
       else
-          SetPosition( FPosition + (Pos - FPosition) * FIncrement );
+        SetPosition(Pos);
     SB_THUMBTRACK:
       if Tracking then
         if FCalcRange > 32767 then
@@ -19919,4 +19919,3 @@
 {$ENDIF}
   InitScrollProcs;
 end.
-
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to