[Lazarus] Forwarding events/messages

Ondrej Pokorny lazarus at kluug.net
Wed Nov 4 18:32:57 CET 2015


On 04.11.2015 18:29, Martin Grajcar wrote:
> On Wed, Nov 4, 2015 at 6:07 PM, Ondrej Pokorny <lazarus at kluug.net 
> <mailto:lazarus at kluug.net>> wrote:
>
>
>     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 
> nothing at all.
>

This is why I said don't do that :)

>>     My workaround is to scroll manually, like
>>
>>     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.

Yes that's true and correct. AFAIK on other OS than Win, no change to do 
it differently. Maybe Zeljko knows some dirty tricks ;)

Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20151104/bbbffd05/attachment-0003.html>


More information about the Lazarus mailing list