TextUndo(3) User Contributed Perl Documentation TextUndo(3)

# [NAME](#NAME)

Tk::TextUndo - perl/tk text widget with bindings to undo changes.

# [SYNOPSIS](#SYNOPSIS)

    **use Tk::TextUndo;**

    *$testundo* = *$parent*-&gt;**TextUndo**(?*-option*=&gt;*value*, ...?);

# [DESCRIPTION](#DESCRIPTION)

This IS-A text widget with an unlimited 'undo' history but without a re'undo' capability.

## [Bindings](#Bindings)

The "TextUndo" widget has the same bindings as the Text widget. In addition there are the following bindings:

[Event &lt;L4&gt; &lt;&lt;Undo&gt;&gt;](#Event)

undo the last change. Pressing &lt;L4&gt; several times undo step by step the changes made to the text widget.

## [Methods](#Methods)

The "TextUndo" widget has the same methods as "Text" widget. Additional methods for the "TextUndo" widget are:

$text-&gt;Load($filename);

Loads the contents of the $filename into the text widget. **Load()** delete the previous contents of the text widget as well as its undo history of the previous file.

$text-&gt;Save(?$otherfilename?)

Save contents of the text widget to a file. If the $otherfilename is not specified, the text widget contents writes the file of $filename used in the last **Load()** call. If no file was previously **Load()**'ed an error message pops up. The default filename of the last **Load()** call is not overwriten by $otherfilename.

$text-&gt;FileName(?$otherfilename?)

If passed an argument sets the file name associated with the loaded document. Returns the current file name associated with the document.

# [KEYS](#KEYS)

widget, text, undo

# [SEE ALSO](#SEE_ALSO)

Tk::Text, Tk::ROText

2026-10-25 perl v5.44.0

---

Document: Tk::TextUndo(3pm) from perl-tk 804.036-r12 (Chainguard OS)
Source: https://github.com/eserte/perl-tk
