[Lazarus] ScrollBox - How to get proper scrolling for a TPanel?

Michael W. Vogel m-w-vogel at gmx.de
Wed Jan 6 23:40:12 CET 2016


I've a similar problem, so I made a little test, but it is imho not the 
best solution (I have some flickering, but it works on Windows(7) ).

You can use a own inherited TPanel and override its WndProc to send the 
message to its parent (TScrollBox):

uses  Classes, ExtCtrls, LMessages, Forms, Controls;

type
   TMyPanel = class(TPanel)
     procedure WndProc(var TheMessage: TLMessage); override;
   end;

...

procedure TMyPanel.WndProc(var TheMessage: TLMessage);
var
   aControl: TControl;
begin
   case TheMessage.Msg of
     LM_MOUSEWHEEL:
       begin
         aControl := Parent;
         if Assigned(aControl) then
           aControl.Perform(TheMessage.Msg, TheMessage.wParam, 
TheMessage.lParam);
         Exit;
       end;
   end;
   inherited WndProc(TheMessage);
end;


Am 06.01.2016 um 15:16 schrieb Gabor Boros:
> Hi All,
>
> I have a TScrollBox (Height=150) and a TPanel (Height=450) in it.
> With Linux-Qt I can scroll up and down if the mouse over the 
> scrollbar, the empty space or the Panel in 13 steps.
> With Windows can scroll if over the scrollbar or the empty space (in 
> 13 steps too). But the scroll not working if mouse over the Panel. I 
> can override DoMouseWheel but down know how to get the 13 steps long 
> scrolling from it. Any idea? (I use latest fixes_1_6.)
>
> Gabor
>
> -- 
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus





More information about the Lazarus mailing list