On Mon, 21 Jan 2013 08:52:32 +0008
xrfang <[email protected]> wrote:

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

A TPainBox can not get focus, so it can not get keyboard events.

 
> 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.

You could create a component with ancestor TCustomControl. That has a
Canvas and whatever events you need.
 
> 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?

Yes.

> Attached is a draft of my tpaintrect class.

Mattias

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to