[Lazarus] Handle user inputs

xrfang xrfang at gmail.com
Mon Jan 21 09:44:32 CET 2013


Hi Mattias,

I try to process keyboard events to a TPaintBox, which does not have OnKeyDown etc.  

I am writing a class which I hope to be as clean as possible. The class is called TPaintRect, which let me paint on certain part (rect) of a canvas.

I can of course try to interpret keyboard event of the form, but I hope not to interfere with other components (for example, avoid set Form.KeyPreview=true).

Is it possible?

Attached is a draft of my tpaintrect class.

Thanks a lot.

Sincerely,
Shannon

在 一, 1月 21, 2013 at 3:08 下午,xrfang <xrfang at gmail.com> 写道:
Hi,

I want to use TApplicationProperties.OnUserInput to process keyboard/mouse events.  But the parameter of this method is a Cardinal.   My questions are:

1) How do I know its event type, such as keydown/keyup/keypress or mouse move etc?

2) How do I know the actual key that is pressed, or the X, Y coordinates of the mouse?

Thanks,
Shannon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130121/5a5b4c03/attachment-0003.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.tar.bz2
Type: application/x-bzip-compressed-tar
Size: 71680 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130121/5a5b4c03/attachment-0003.bin>


More information about the Lazarus mailing list