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

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Oct 17 19:39:14 EDT 2011

At Mon, 17 Oct 2011 16:33:26 +0200, Marijn wrote:
> Is it correct, that when you click the title bar of a window frame to
> select it, this causes the on-focus method of that frame to be called.

That's not what's supposed to happen. The `on-activate' method of the
frame should be called, though.

> Further that on-focus method should check which sub-window had the
> focus before and call that subwindow's on-focus method to restore
> focus. This will recursively restore the focus.

No, the `on-focus' call should go directly to the window that has the
focus relative to the frame.

I see that what I think should happen isn't what happens on Gtk. The
frame gets `on-focus' when one of its subwindows gets the focus, and
`on-activate' has problems. I'll work on that.

> Conversely when you click the title bar of a different window frame B
> to deselect window A, then A's on-focus method is also called with as
> sole argument #f. The same recursive process as above is used to
> remove focus from any subwindows.

Only the window with the focus is supposed to get the `on-focus' call
as focus leaves, while the frame should receive `on-activate'.



Posted on the users mailing list.