[racket] how to add text-field-style behavior to rectangles drawn on a canvas

From: Marijn (hkBst at gentoo.org)
Date: Fri Oct 7 09:01:58 EDT 2011

Hash: SHA1

On 10/07/11 14:17, Matthew Flatt wrote:
> At Fri, 07 Oct 2011 13:06:23 +0200, Marijn wrote:
>> I've prepared a chopped-down attempt which defines an editor, an 
>> administrator and a display class and instantiates them.
>> Unfortunately the editor doesn't appear on the screen where I
>> thought I'd let the administrator tell it to appear.
>> I'm not sure why it doesn't work. Any help?
> All windowing events go to the `canvas%', and the built-in canvas 
> methods know nothing about your editor admin. You need to override 
> `on-paint' to pass on the message to the editor, `on-focus' to
> notify the editor, `on-event' to send events on to the editor, and
> so on.
> See enclosed.
> I changed the direct calls to `refresh' to instead send `refresh'
> to the canvas, and then the canvas's `on-paint' calls the editor's 
> `refresh'. Otherwise, you have to erase the area for the editor
> before redrawing the editor, and the windowing system is usually
> better at scheduling the refresh.

Thanks Matthew, that is immensely helpful!

Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


Posted on the users mailing list.