The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Tk::Multi::Text - Tk composite widget with a scroll window and more

SYNOPSIS

 use Tk::Multi::Manager;

 use Tk::Multi::Text ; 

 my $manager = yourWindow -> MultiManager 
  (
   menu => $menu_ref , # optionnal
   title => "windows" # optionnal
  ) -> pack ();

 # Don't pack it, the managet will do it
 my $w1 = $manager -> newSlave('type' => 'MultiText', 'title' => 'a_label');

DESCRIPTION

This composite widget features :

  • a scrollable read-only text window (based on ROtext)

  • 2 buttons on the left side of the widget to resize height of the window. (I should use packAdjust but I couldn't get it to work well. I may do it later)

  • A print button (The shell print command may be modified by setting $Tk::Multi::Text::printCmd to the appropriate shell command. By default, it is set to 'lp -ol70 -otl66 -o12 -olm10')

  • a clear button

This widget will forward all unrecognize commands to the ROtext object.

Note that this widget should be created only by the Multi::Manager.

WIDGET-SPECIFIC OPTIONS

title

Some text which will be displayed above the test window.

The log window feature a set of menu items which must be added in a menu. This menu ref must be passed with the menu_button prameter to the object during its instaciation

data

A string which will be displayed in the text window.

WIDGET-SPECIFIC METHODS

setSize( heigth, [ width ])

Will resize the text window. Heigth lower than 5 are ignored.

insertText($some_text)

Insert the passed string at the bottom of the text window

print

Will raise a popup window with an Entry to modify the actual print command, a print button, a default button (to restore the default print command), and a cancel button.

doPrint

Print the title and the content of the text window. The print is invoked by dumping the text content into a piped command. By default this command is set to 'lp -ol70 -otl66 -o12 -olm10' which works fine on my HP-UX machine with A4 paper.

You may want to set up a new command to print correctly on your machine. You may do it by using the setPrintCmd method or by invoking the 'print' method.

setPrintCmd('print command')

Will set the $printCmd class variable to the passed string. You may use this method to set the appropriate print command on your machine. Note that using this method will affect all other Tk::Multi::Text object since the modified variable is not an instance variable but a class variable.

clear

Is just a delete('1.0','end') .

Delegated methods

By default all widget method are delegated to the Text widget. Excepted :

command(-label => 'some text', -command => sub {...} )

Delegated to the menu entry managed by Multi::Manager. Will add a new command to the aforementionned menu.

AUTHOR

Dominique Dumont, Dominique_Dumont@grenoble.hp.com

Copyright (c) 1997-1998 Dominique Dumont. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

perl(1), Tk(3), Tk::Multi(3), Tk::Multi::Manager(3)