[Lazarus] TLabel inside a TScrollBox (under Win32) MouseWheel issue

Sandro Cumerlato sandro.cumerlato at gmail.com
Fri Jul 18 23:26:54 CEST 2014


To whom who may concern...

I've created a sample package with an example to demonstrate how to
solve this issue without altering the LCL, but providing a derived
component instead:

https://code.google.com/p/mousewheelcontrols/

Comments are welcome.

Sandro Cumerlato


On 15 July 2014 19:43, Sandro Cumerlato <sandro.cumerlato at gmail.com> wrote:
> Reference: "[Lazarus] Scrollbox and mousewheel"
> http://lists.lazarus.freepascal.org/pipermail/lazarus/2012-July/074650.html
>
>
> Hello everybody,
> I'm writing to you about an issue discovered while using a TLabel
> inside a TScrollBox (under Win32).
>
> The problem is that the TLabel hides the MouseWheel action of the
> TScrollBox if the mouse is over the TLabel.
>
> To solve this problem I've exposed the Label1.OnMouseWheel property to
> call the following ScrollBox1.OnMouseWheel event:
>
> procedure TFormMain.SrollBox1MouseWheel(Sender: TObject; Shift: TShiftState;
>   WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
> begin
>   with SrollBoxRight.VertScrollBar do
>     Position := Position - Sign(WheelDelta) * Increment;
>   Handled := true;
> end;
>
>
> The attached patch exposes the TLabel.OnMouseWheel event to solve the
> TLabel/TScrollBox MouseWheel issue.
>
> For the same reason, IMHO, other GUI controls that can be inserted
> into a TScrollBox should expose OnMouseWheel event.
>
>
> Thank you for reading!
>
> Sandro Cumerlato




More information about the Lazarus mailing list