[plt-scheme] proper undo handling

From: Mike T. Machenry (dskippy at ccs.neu.edu)
Date: Wed Apr 16 17:53:48 EDT 2003

The test-suite tool uses frame:standard-menus. I miscommunicated that.
Currently, the undo and redo buttons are always disabled. I tried to
use the built in undo/redo by overriding the get-editor-target-object
which should give the callbacks and demand methods a target, but doing
so provides the following undesirable behavior

add a new test case
type "foo" into the expression box
add a new test case
type "bar" into the expression box
put mouse focus into box with "foo"
click undo in the menu

result : "foo" disappears
a.k.a. : each separate box has its own undo and redo operations which are
not tied to the main editor's

Does this behavior surprise you or is it normal?
Is there an easy way to fix this or should I continue trying things of my own?


On Wed, Apr 16, 2003 at 04:14:47PM -0500, Robby Findler wrote:
> I don't think that you need to do that. You should be able to use
> frame:standard-menus and all that should be taken care of. Have a look
> at the docs for all of the methods that begin with edit-menu:undo and
> edit-menu:redo.
> Robby
> At Wed, 16 Apr 2003 17:03:21 -0400, "Mike T. Machenry" wrote:
> >   For list-related administrative tasks:
> >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> > 
> > Hey, I am currently adding undo/redo behavior to my test-suite tool. I wanted
> > to run my implementation by everyone. It has been the case at least once (with
> > modified? flags of editors) that there was a built in automated way to do what
> > I was trying to do. What I am planning to do is this.  
> > 
> > override my frame:basic method
> >   (define/override (edit-menu:undo-callback item event)
> >     (send (get-editor) undo)
> >     (unless <I still need the undo menu item>
> >       <disable the undo menu item>))
> > do the same for redo
> > override my set-modified method to make the undo and redo menu items enabled
> > 
> > Does this sound right?
> > 
> > Thanks,
> > -mike
> > 
> > 

Posted on the users mailing list.