Tk::MDI - Multiple Document Interface for Tk
use Tk; use Tk::MDI;
$mw = tkinit; $mdi = $mw->MDI( -style=>'win32', -background=>'white'); $child1 = $mdi->add; $text = $child1->Text->pack; $text->insert('end',"A text widget");
$child2 = $mdi->add(-titletext=>'Listbox Title'); $lb = $child2->Listbox->pack; $lb->insert(0,"A Listbox");
$child3 = $mdi->newWindow(-titlebg=>'white'); $c = $child3->Scrolled('Canvas',-scrollbars=>'se')->pack; $c->create('text',50,50,-text=>"A Canvas");
MainLoop;
The following standard widget options are supported:
-background/-bg
If this option can be specified in two ways.. If a reference to a user created menu is given, then the MDI menu will be cascaded to that menu. If no menu reference is given then a new Menu will be created to be accessible according to the value of this -menu option. In this case, the value shall be one of: menubar, popup, both, or none. The default value is both.
The -menu option is not meant to be adjusted via the configure method. It should really only be used at MDI creation.
Note: This is best turned on when using all of a similar type of widget - such as a Text widget (like a true MDI).
NOTE: This currently cannot be changed by the configure method so it MUST be stated at MDI creation in order to set the button images properly.
This module emulates MDI type functionality with a twist. The twist is ... virtually any Tk widget can be used! Hence, the 'D' in MDI is somewhat of a misnomer.
The MDI method creates a new MDI window (i.e. a Frame) and returns a blessed reference to the MDI widget. The MDI widget is created as a direct descendent of the Toplevel or MainWindow of the calling $widget. The purpose of the MDI widget is to serve as a container to confine child windows; which can be created at any time using the methods described below.
The MDI functionality has been designed to mimic as closely as possible other MDI applications such as PFE and MSWord.
The MDI method creates a new object. This object supports the configure and cget methods described in options which can be used to enquire and modify most of the options described above.
The following additional methods are available for MDI widgets:
Where allowable options are:
All MDI child windows are confined to the MDI space. This is a standard feature of MDI. On Win32 - this will work best if you have Win32::API installed. If it is, then the windows will be confined using the native win32 'ClipCursor' API function. Otherwise, a perl only 'hack' is invoked.
This should be considered a Beta version. We would like feedback on any bugs you find, or enhancements you would like to see. Please read the ToDo list to see what we have planned.
On win32 - sometimes if a child window titlebar lies directly beneath a menu item, the buttonrelease event from the menu will trigger on that child window.
Titlebar 'flickers' on Enter and Leave events.
Still do not have keyboard focus working for internal widgets.
Smart placement needs to get smarter.
If run on a dual-monitored system - there may be some bugs in moving or resizing a child window if the pointer is on the edge of the second screen.
Ala Qumsieh <aqumsieh@hyperchip.com> Jack Dunnigan <jack.dunnigan@ec.gc.ca>
Copyright (c) 2002 Ala Qumsieh & Jack Dunnigan. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.