Ondrej Pokorny wrote 25 lines
On 04.11.2015 17:54, Martin Grajcar wrote:
I'd like to forward a TLMVScroll message to the parent component as a
workaround for controls preventing parents from receiving mouse wheel
events (I couldn't find out how to let the parents receive them).
The problem is that the handler is
PROCEDURE TWhatever.WMVScroll(VAR Message : TLMVScroll);
and I need to put it in
FUNCTION SendMessage(HandleWnd: HWND; Msg: Cardinal; WParam: WParam;
LParam: LParam): LResult;
Or am I missing a more suitable procedure? Why is there no
SendMessage(Message : TLMVScroll);
which would do exactly this?
There is TControl.WndProc, but don't call it directly if you don't know
what and why you are doing it.
I found it in the meantime... and the usage seems to be obvious (if the parent instance and message type checks pass, then send it to the parent, otherwise call inherited). The tiny problem is that it does workaround is to scroll manually, like
Show quoted text 8 lines
TScrollingWinControl(Parent).ScrollBy (0, ScrollAmount);
but this feels stupid as it duplicates the ScrollAmount computation.
AFAIK forwarding of messages works only on Windows,
This could be the reason for my code doing nothing. :(
so if you need it cross-platform, you will have to use
"TScrollingWinControl(Parent).ScrollBy (0, ScrollAmount);" in any case. So
this should be the correct way to do it.
That's ugly like hell and I can only guess the ScrollAmount, which means that it can scroll much more or less than when the mouse it outside of my TControl.
Anyway, thank you!
Martin.
- Zeljko, correct me if I am wrong, you are the specialist here :)
Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20151104/d6ca4345/attachment.html>