Hi Mattias,<div><br></div><div>I try to process keyboard events to a TPaintBox, which does not have OnKeyDown etc.  </div><div><br></div><div>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.</div><div><br></div><div>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).</div><div><br></div><div>Is it possible?</div><div><br></div><div>Attached is a draft of my tpaintrect class.</div><div><br></div><div>Thanks a lot.</div><div><br></div><div>Sincerely,</div><div>Shannon<br><br>

在 一,  1月 21, 2013 at 3:08 下午,xrfang <xrfang@gmail.com> 写道:<br>
<blockquote type="cite">Hi,<div><br></div><div>I want to use TApplicationProperties.OnUserInput to process keyboard/mouse events.  But the parameter of this method is a Cardinal.   My questions are:</div><div><br></div><div>1) How do I know its event type, such as keydown/keyup/keypress or mouse move etc?</div><div><br></div><div>2) How do I know the actual key that is pressed, or the X, Y coordinates of the mouse?</div><div><br></div><div>Thanks,</div><div>Shannon</div></blockquote><br></div>