[plt-scheme] redirecting all keyboard to a widget (MrEd)

From: Robby Findler (robby at cs.uchicago.edu)
Date: Mon Aug 9 09:53:29 EDT 2004

At Mon, 9 Aug 2004 15:34:44 +0200 (CEST), Ivanyi Peter wrote:
> Robby Findler <robby at cs.uchicago.edu> írta:
> Thanks for the help, but
> > I don't know that there is a clean way to do that, since it goes
> > against the design of the underlying toolkits. How about just sending
> > the keyboard focus to the place where you want to send the 
> keystrokes
> > (with the `focus' method)?
> if I try:
> (define my-window%
>   (class frame%
>     (define/override (on-subwindow-char window event)
>       (send my-text focus)
>       #f
>     )
>     ......
> then the character goes to the widget which has the focus, for example 
> button, menu, etc and then the focus jumps to my text field and later
> typing goes to the text-field, but I have lost that character (which is not
> good for me).

Don't do it there. Just set the focus initially and set the focus in
button callbacks and other things when you find the focus leaves.

> Another question then: How can I send the backspace and delete keys
> to a text-field so that will react on it?

try on-char instead of insert, but it's painful.


Posted on the users mailing list.