[plt-scheme] A graphic toplevel
You should define a class, such as this lexer/parser%, which is a text%,
but define/override's the on-char method, commes ca:
(define lexer/parser%
(class text%
(super-instantiate ())
(rename (on-char super-on-char))
(define/override (on-char event)
(define key (send event get-key-code))
(if (or (equal? key #\return)
(equal? key 'numpad-enter))
(handle-return)
(super-on-char)))))
This example assumes calls (handle-return) when return is pressed, and
works as a text% normally would on any other key.
It has not been tested; maybe the parenthesis are a bit wrong or I mixed
something up, but this is the general idea.
Good luck.
-----Original Message-----
From: The Computer Man [mailto:thecomputerman at wanadoo.fr]
Sent: Wednesday, January 07, 2004 12:15 AM
To: plt-scheme at list.cs.brown.edu
Subject: [plt-scheme] A graphic toplevel
For list-related administrative tasks:
http://list.cs.brown.edu/mailman/listinfo/plt-scheme
Hello,
I'm writting an lexer/parser with a "toplevel" read-eval-loop. I can
replace
the toplevel scheme by this, and now i try to make it in graphic mode. I
find an idea with two editor-canvas and a button, i'm explain, in the
first
editor the user write the question, and when i want to eval this
question
he's click on the button and the result was written in the second
editor.
But i want to automatics this system like the toplevel of Scheme, when
the
user press enter the question was eval and written, but i can't find an
mred
objets who can do this.
Can you help me ?
Thanks for avancy for your answer.