Elijah has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to work in some undo methods in an already established text widget I have in a program I have been developing. I have tried to implement it as it seems it wants to be implemented but when I envoke the undo feature nothing happens, no error or undo is accomplished.

How would I go about using this TextUndo?

my $t = $mw->Scrolled("Text", -scrollbars => 'e', -font => ['Courier N +ew', '10'])->pack(-side => 'top', -fill => 'both', -expand => 1); my $ts = $mw->Frame->pack(-side => 'top', -fill => 'x'); my $status = $mw->Scrolled("Text", -scrollbars => 'e', -height => '8', + -font => '12')-> pack(-side => 'top',-fill => 'x', -expand = +> 0); my $undo = $t->TextUndo(); my $edit_menu = $menubar->cascade(-label => "~Edit", -tearoff => 0); $edit_menu->command(-label => '~Undo', -command => sub {$undo->undo()});
This is a snippet from my app that contains the code in question. I try to assign the widget $t to $undo and then call the undo method of TextUndo but like I said nothing happens. What am I doing wrong here?

Replies are listed 'Best First'.
Re: TextUndo in an already established text widget?
by matija (Priest) on Mar 24, 2004 at 21:55 UTC
    Tk::TextUndo isa Tk::Text .

    You should be creating the widget with:

    my $t = $mw->Scrolled("TextUndo"...
A reply falls below the community's threshold of quality. You may see it by logging in.