ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП |
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы. |
16. GUI Example: Man Page ViewerHelp wanted. Telepath. You know where to apply. - Anonymous The primary objective of this chapter is to exercise some of the most important capabilities of Tk's text widget; a man page viewer called perlman provides an ideal test case.[1] In this chapter, you will familiarize yourself with the widget's text insertion, deletion, and retrieval capabilities; use a variety of indexing primitives; create and configure tags; and perform regular expression searching and highlighting of text. Along the way, you'll also learn to use entry widgets and construct menus dynamically.
perlman is modeled after TkMan [5], a very nice man page viewer written by Thomas Phelps at the University of California at Berkeley, using Tcl/Tk. perlman contains only a small subset of TkMan's functionality. Thomas has also written an experience paper entitled "Two Years with TkMan: Lessons and Innovations. Or, Everything I Needed to Know about Tcl/Tk I Learned from TkMan" [6]. It presents a good case for writing the entire utility in a scripting language and unwittingly convinces us, smug Perl programmers that we are, why Perl would have been the ideal choice. Please see the Section 16.3, "Resources" section at the end of this chapter for pointers to TkMan and this paper. 16.1 man and perlmanUnix manual pages are normally viewed by the Figure 16.1: perlman screenperlman, shown in Figure 16.1, is a GUI wrapper over man. To view a topic, you have to enter a string in the "Show" box and press the Return key. To highlight all pieces of text matching a given regular expression, simply enter it in the "Search" box and press Return. You can also perform exact string searches and ignore case optionally. In addition, perlman provides the following features:
|