Dominique Dumont > Tk-Multi-1.006 > Tk::Multi::Toplevel

Download:
Tk-Multi-1.006.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 1.009   Source  

NAME ^

Tk::Multi::Toplevel - Toplevel MultiManager

SYNOPSIS ^

 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";}
        );

DESCRIPTION ^

This class is a Tk::Multi::Manager packed in a Toplevel window. It features also :

Users menus ^

By default the Multi::Toplevel widget comes with 3 menubuttons:

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.

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 widget.

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 ^

Users menus are also advertised (See below)

delegated methods ^

Methods ^

menuCommand()

Parameters are :

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 ()

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 :

Will invoke the Tk::Pod documentation widget of the specified 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/mailing-lists/ptk/1998-11/msg00033.html)

AUTHOR ^

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.

SEE ALSO ^

perl(1), Tk(3), Tk::Multi::Manager(3), Tk::Pod(3), Tk::ObjScanner(3), Tk::mega(3)

syntax highlighting: