multi::toplevel(3)

NAME

Tk::Multi::Toplevel - Toplevel MultiManager

SYNOPSIS

use 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->foo0;});
# add a menu button on the 'File' menu
$p->add(
        'command',
        -label => 'baz',
        command => sub {warn "invoked  File->baz0;}
       );

DESCRIPTION

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

Users menus

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 menu
Command 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 'exam
ple' menu. Note that menu buttons are sorted alphabeti
cally.
Then if the user call :

$widget->menuRemove(name => 'bar', menu => 'example');
The bar button will be removed from the menu bar.

Constructor configuration options

manager

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.

podName

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 wid
get.

By default, the help button will display the pod file of
Multi::TopLevel.

podSection

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.

Advertised widgets

· 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)
delegated methods
· newSlave, hide, show, destroySlave : To the
Tk::Multi::Manager
· add, delete, insert : To the 'File' Tk::Menu

Methods

menuCommand()

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.

menuRemove ()

· name: button_name

· menu: menu_name

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.

showHelp (...)

Parameters are :

· 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 sec
tione name passed to the constructor or to 'DESCRIP
TION')
Will invoke the Tk::Pod documentation widget of the speci
fied pod file and pod section.

BUGS

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/mail
ing-lists/ptk/1998-11/msg00033.html)

AUTHOR

Dominique Dumont, Dominique_Dumont@grenoble.hp.com

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

SEE ALSO

perl(1), Tk(3), Tk::Multi::Manager(3), Tk::Pod(3), Tk::ObjScanner(3), Tk::mega(3)
Copyright © 2010-2025 Platon Technologies, s.r.o.           Home | Man pages | tLDP | Documents | Utilities | About
Design by styleshout