Tk::Multi::Toplevel - Toplevel MultiManager
use Tk::Multi::Toplevel ; my $mw = MainWindow-> new ; my $p = $mw->MultiTop(); # If Multi::Toplevel is the only Tk window of your application $mw -> withdraw ; # hide the main window # destroy the main window when close is called $p -> OnDestroy(sub{$mw->destroy}); # add a 'bar' menu with a 'foo' button on the menu bar $p->menuCommand(name => 'foo', menu => 'bar', sub => sub{warn "invoked bar->foo\n";}); # add a menu button on the 'File' menu $p->add( 'command', -label => 'baz', -command => sub {warn "invoked File->baz\n";} );
This class is a Tk::Multi::Manager packed in a Toplevel window. It features also :
'File->show internal...' button to invoke an Object Scanner (See Tk::ObjScanner)
A facility to manage user menus with sorted buttons
A help facility based on Tk::Pod
By default the Multi::Toplevel widget comes with 3 menubuttons:
'File' for the main widget commands
'windows' to manage the Multi slaves widget
'Help'
The user can also add its own menus and menu buttons to the main menubar. When needed the user can call the menuCommand method to add a new menu button (and as new menu if necessary) . Then the user can remove the menu button with the menuRemove command.
For instance, if the user call :
$widget->->menuCommand(name => 'foo', menu => 'example', sub => \&a_sub);
The menubar will feature a new 'example' menu with a 'foo' button.
Then if the user call :
$widget->->menuCommand(name => 'bar', menu => 'example', sub => \&a_sub);
The menubar will feature a new 'bar' button in the 'example' menu. Note that menu buttons are sorted alphabetically.
$widget->menuRemove(name => 'bar', menu => 'example');
The bar button will be removed from the menu bar.
Object reference that will be scanned by the ObjScanner. Usefull when you want to debug the object that actually use the Multi::TopLevel. By default the ObjScanner will scan the Multi::TopLevel object.
This the name of the pod file that will be displayed with the 'Help'->'global' button. This should be set to the pod file name of the class or the application using this widget.
By default, the help button will display the pod file of Multi::TopLevel.
This the section of the pod file that will be displayed with the 'Help'->'global' button.
By default, the help button will display the 'DESCRIPTION' pod section.
fileMenu: 'File' Tk::Menu (on the left of the menu bar)
menubar : the Tk::Frame containing the menu buttons
multiMgr: The Tk::Multi::Manager
Users menus are also advertised (See below)
newSlave, hide, show, destroySlave : To the Tk::Multi::Manager
add, delete, insert : To the 'File' Tk::Menu
Parameters are :
name: button_name
menu: menu_name
command: subref
Will add the 'button_name' button in the 'menu_name' menu to invoke the sub ref. If necessary, the 'menu_name' menu will be created.
Will remove the 'button_name' button from the 'menu_name' menu. If no buttons are left, the 'menu_name' menu will be removed from the menu bar.
pod: pod file name (optional, defaults to the file name passed to the constructor or to 'Tk::Multi::Toplevel')
section: pod_section (optional, defaults to the sectione name passed to the constructor or to 'DESCRIPTION')
Will invoke the Tk::Pod documentation widget of the specified pod file and pod section.
Users menu does not fold when you insert a lot of buttons.
Tk::Pod 0.10 does not display the specified section. Use a later version or this patch (http://www.xray.mpe.mpg.de/mailing-lists/ptk/1998-11/msg00033.html)
Dominique Dumont, domi@komarr.grenoble.hp.com
Copyright (c) 1997-1998,2004 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.
perl(1), Tk(3), Tk::Multi::Manager(3), Tk::Pod(3), Tk::ObjScanner(3), Tk::mega(3)
To install Tk::Multi::Any, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tk::Multi::Any
CPAN shell
perl -MCPAN -e shell install Tk::Multi::Any
For more information on module installation, please visit the detailed CPAN module installation guide.