in reply to TextUndo in an already established text widget?
You should be creating the widget with:
my $t = $mw->Scrolled("TextUndo"... [download]