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

2014-07-18 Thread Sandro Cumerlato
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.cumerl...@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

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


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

2014-07-15 Thread Sandro Cumerlato
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
Index: /freepascal/laz/1.3/lcl/stdctrls.pp
===
--- /freepascal/laz/1.3/lcl/stdctrls.pp (revisione 45865)
+++ /freepascal/laz/1.3/lcl/stdctrls.pp (copia locale)
@@ -1502,6 +1502,7 @@
 property OnMouseUp;
 property OnMouseEnter;
 property OnMouseLeave;
+property OnMouseWheel;
 property OnChangeBounds;
 property OnContextPopup;
 property OnResize;
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus