Thanks for that, it worked.  

Is there a reason why a new text% object has undo disabled? I could not find 
any mention of it in the documentation and 'set-max-undo-history' is not the 
first place one would look :-)

Thanks again,
Alex.

On Tuesday, September 20, 2016 at 10:14:03 PM UTC+8, Matthew Flatt wrote:
> Use the `set-max-undo-history` method to enable undo history:
> 
>  (send m-edit set-max-undo-history 1000)
> 
> 
> At Tue, 20 Sep 2016 06:24:49 -0700 (PDT), Alex Harsanyi wrote:
> > Consider the following example (this is pretty much the code from 
> > http://docs.racket-lang.org/gui/editor-overview.html?q=text%25 except I 
> > also 
> > added a text-field%):
> > 
> > #lang racket/gui
> > (define f (new frame% [label "Simple Edit"]
> >                       [width 200]
> >                       [height 200]))
> > (define c (new editor-canvas% [parent f]))
> > (define t (new text%))
> > (send c set-editor t)
> > 
> > (new text-field% [parent f] [label ""] [style '(multiple)])
> > 
> > (define mb (new menu-bar% [parent f]))
> > (define m-edit (new menu% [label "Edit"] [parent mb]))
> > (define m-font (new menu% [label "Font"] [parent mb]))
> > (append-editor-operation-menu-items m-edit #f)
> > (append-editor-font-menu-items m-font)
> > 
> > (send f show #t)
> > 
> > In the text% editor, normal text operations (select all, cut/copy/paste) 
> > work 
> > fine, but undo does not, the undo menu is grayed out and Ctrl-Z does not 
> > work.  Undo works fine in the text-field% below.
> > 
> > How do I add undo functionality to text%?
> > 
> > Thanks,
> > Alex.
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to racket-users+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to