[plt-scheme] override on-char
At Mon, 30 Dec 2002 14:14:18 CET, michel.pepino at club-internet.fr wrote:
> (define my-scheme:text%
> (class scheme:text%
> (override on-char)
> (define on-char
> (lambda (event)
> (send text-definition insert (send event get-key-code))))
> (super-instantiate ())))
>
>
> (define definition (instantiate editor-canvas% ($panel-editor)))
> (define text-definition (instantiate my-scheme:text% ()))
> (send definition set-editor text-definition)
>
>
> this code don't work when i tape on backspace, left, top, ...
> any idea?
The default `on-char' calls `on-local-char' (when the caret is not
owned by an embedded snip), which calls `on-default-char' (unless the
editor's keymap handles the event). See the docs for `on-default-char'
in text% for information about what the default method does for you.
Matthew