home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeMastering Perl/TkSearch this book

8.21. The ROText Widget

The ROText widget is yet another widget derived from the basic Text widget. As you might suspect, RO stands for read-only. The ROText widget can only be manipulated programmatically via method calls; any bindings that might alter the contents of the widget have been removed. Other bindings that don't change the contents will remain the same; for instance, the user can still scroll up and down, as well as select, find, and copy text from within an ROText widget.

This widget is often used to present instructions, help information, or other data. One of the benefits of using a ROText widget over a Text widget is that you don't have to keep changing the state of the widget in order to insert data into it. If you set the -state of a Text widget to 'disabled', you need to set it back to 'enabled' even before you can do a programmatic insert. This is very tedious if you have a lot of updates and changes to the data in response to a user's action. Using ROText solves this problem for you nicely.

Other than the read-only aspect of ROText, you can simply pretend this a Text widget as you code. That's one of the beautiful aspects of object-oriented programming: this widget is used identically to a Text widget, at least from the programmer's point of view.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.