[plt-scheme] MrEd Learning

From: Alex Peake (alex.peake at comac.com)
Date: Fri Aug 22 15:30:01 EDT 2003

Thanks for looking at this Mike.

Just to be absolutely sure, I copied and pasted the below code back to DrScheme (I use Windows
2000):
Still no response to keyboard.

For the second example, I figured that if you change:
(append-editor-operation-menu-items m-edit)
To:
(append-editor-operation-menu-items m-edit #f)

It works! (Documentation bug).

Alex


> Date: Thu, 21 Aug 2003 12:35:47 -0500
> From: mike <mh983 at netscape.net>
> To: plt-scheme at list.cs.brown.edu
> Subject: [plt-scheme] RE: MrEd Learning
>
> Hello Alex.  As far as the first example, assuming you copied/pasted the
> example so there are no typos, then clicking on the canvas first, then
> pressing a keyboard key worked for me.  I'm using plt on a Mandrake
> Linux/Gnome machine.
>
> mike
>
> > From: "Alex Peake" <apeake at comac.com>
> > To: <plt-scheme at list.cs.brown.edu>
> > Date: Sat, 16 Aug 2003 21:48:19 -0700
> > Subject: [plt-scheme] MrEd Learning
> >
> > I am trying out MrEd - following the manual.
> >
> > In 2. Windowing Toolbox Overview, the example is:
> >
> > ;; Make a frame by instantiating the frame% class
> > (define frame (instantiate frame% ("Example")))
> > ;; Make a static text message in the frame
> > (define msg (instantiate message% ("No events so far..." frame)))
> > ;; Make a button in the frame (using keyword-based arguments, for demonstration)
> > (instantiate button% () (label "Click Me") (parent frame)
> > ;; Callback procedure for a button click
> > (callback (lambda (button event) (send msg set-label "Button click"))))
> > ;; Show the frame by calling its show method
> > (send frame show #t)
> >
> > ;; Derive a new canvas (a generic drawing window) class to handle events
> > (define my-canvas%
> >   (class canvas% ; The base class is canvas%
> > ;; Declare overrides:
> > (override on-event on-char)
> > ;; Define overriding method to handle mouse events
> > (define on-event (lambda (event) (send msg set-label "Canvas mouse")))
> > ;; Define overriding method to handle keyboard events
> > (define on-char (lambda (event) (send msg set-label "Canvas keyboard")))
> > ;; Call the superclass initialization (and pass on all init args)
> > (super-instantiate ())))
> > ;; Make a canvas that handles events in the frame
> > (instantiate my-canvas% (frame))
> >
> > The following text says: Clicking on the canvas calls on-event. While the canvas has
> the keyboard
> > focus, typing on the keyboard invokes the canvas’s on-char method.
> >
> > However, this never happens - the message never gets changed to "Canvas keyboard"?
> >
> >
> > In 8. Editor Toolbox, the example is:
> >
> > (define f (instantiate frame% ("Simple Edit" #f 200 200)))
> > (define c (instantiate editor-canvas% (f )))
> > (define t (instantiate text% ()))
> > (send c set-editor t)
> > (send f show #t)
> >
> > (define mb (instantiate menu-bar% (f )))
> > (define m-edit (instantiate menu% ("Edit" mb)))
> > (define m-font (instantiate menu% ("Font" mb)))
> > (append-editor-operation-menu-items m-edit)
> > (append-editor-font-menu-items m-font)
> >
> > The following text says: The user can also insert an embedded editor by selecting
> Insert Text from
> > the Edit menu;
> >
> > However, there is no  Insert Text choice?
> >
> >
> > -- __--__--
> >



Posted on the users mailing list.