O'Reilly logo

Mastering Perl/Tk by Nancy Walsh, Stephen Lidie

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The TextUndo Widget

The TextUndo widget is derived from the Text widget, which simply means that it shares all the capabilities of its ancestor. In object-oriented terminology, we say that TextUndo is a subclass of Text (or, Text is a superclass of TextUndo). You’ll learn more about this subject in Chapter 14.

Of course, we expect TextUndo to do something different from Text, and it does: it has unlimited undos and redos so that previous editing operations can be rescinded or redone.

Here are the TextUndo methods above and beyond those available for a Text widget:

$textundo->ConfirmDiscard

Displays a messageBox that says “Save edits?”. Returns 0 if yes or cancel, 1 if no.

$textundo->ConfirmEmptyDocument

Displays a messageBox that says “Save edits?.” The widget is cleared if the reply is no.

$textundo->ConfirmExit

Destroys the widget if you answer yes.

$textundo->CreateFileSelect

Creates a popup file browser to select a filename.

$textundo->deleteStringAtStartOfSelectedLines( string )

Deletes string from the start of every selected line.

$textundo>->EmptyDocument

Deletes all text and undo/redo information; undefs the filename.

$textundo->FileName(? pathName ?)

Optionally updates the current filename to pathName. Returns the current filename.

$textundo->IncludeFile

Similar to Load, except it does not call EmptyDocument first.

$textundo->insertStringAtStartOfSelectedLines( string )

Inserts string at the start of every selected line.

$textundo->Load( pathName )

Loads the contents ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required