mdw_lib.tk A classlib for [m]ulti-[d]ocument-[w]indow applications. Contents: --------- 1. What is the mdw_lib 2. The concept 3. How to use it 3.1 The public procedures 3.2 The public variables 4. To do 1. What is the mdw_lib ---------------------- The mdw-lib is a number of Tcl/Tk procedures to create and manipulate multiple childwindows in one Tk application window. It looks similar to an other windowing system but I've forgot the name. My goal was to have multiple windows with similar contents in one main window, without always looking for them all over the screens. 2. The concept -------------- There are two main classes used to create a multi window enhancement for your application. Class mdw_main: -contains all necessary procedures to manage multiple child windows e.g. creating, cascading, activating ... -can exist only once in your Tk - application -the class creates and is connected to the main frame, into all the children will be placed Class mdw_child: -this class can have several instances (one for each childwindow) -it controls the childwindows frame, titlebar and some buttons -contains all necessary procedures to move, resize, hide, activate and close a childwindow -childwindows will be created by a request to the mdw_main class -childwindows owns the client area, an empty frame to put all your own stuff into Summary: The managing class are a number of procedures to create and destroy childwindows and to control their properties and behavior. The child windows are tricky moved and packed frames with some useful functions. 3. How to use it ---------------- For an example run and look at the "mdw_demo" file. 3.1 The public procedures mdw_main: mdw_main::mdw_main {parent mypath} -creates mdw_main object parent: not used mypath: the windowpath for the main frame mdw_main::~mdw_main {} -deletes the mdw_main object mdw_main::create_mdw_frame {} -creates the main frame for the mdw_main object mdw_main::create_child {} -creates a new childwindow -returns the number of the new child mdw_main::destroy_child {child_no} -destroys a child with child_no mdw_main::activate_child {child_no} -activates a child with child_no mdw_main::cascade {} -cascades all children into the main frame mdw_main::tile {} -tiles all children into the main frame mdw_child: mdw_child::create_window {child_no} -creates the window for a child object mdw_child::show {child_no} -shows the childs window mdw_child::maximize {child_no} -maximizes the childs window mdw_child::hide {child_no} -hides the childs window 3.2 The public variables Most of the public variables have initial values, so you don't need to define a lot of them. mdw_main: mdw_main(background) -the background color for the main frame mdw_main(maxchildren) -the maximum number of children that can be created mdw_main(act_child) -the number of the active child mdw_main(child_x) mdw_main(child_y) -the pos to come up for child windows mdw_main(child_en_fg) mdw_main(child_en_bg) -the active childs titlebar colors mdw_main(child_dis_fg) mdw_main(child_dis_bg) -the inactive childs titlebar colors mdw_main(child_but_width) -widht = height of the child window titlebar buttons mdw_main(child_frame_width) -the framewidth of a child mdw_main(child_frame_color) -childs frame color mdw_main(child_corner_len) -childs corner len to recognize a resizing event mdw_main(window_menu_path) -the menu path to where to connect the "Windows" menu mdw_main(width) mdw_main(height) -size of the mainwindow mdw_main(frameopts) mdw_main(packopts) -creating options for the mainwindow mdw_child: mdw_child([child_no],close_cmd) -a user defined callback command to run if close is invoked for this childwindow mdw_child([child_no],activate_cmd) -a user defined callback command to run if childwindow becomes active mdw_child([child_no],client_path) -the childs widget path to insert further client data (an empty frame) mdw_child([child_no],title) -the in childs titlebar 4. To do -------- At this time there are no key bindings for anything except the defaults for the menu. I think they aren't really neccessary. Perhaps if you want some it shouldn't be very difficult to define key bindings by yourself. The problem for the mdw-lib is that it needs to know all the widgets inside the childs client area to connect them to an event for the whole child. E.g. for hiding ore closing a child window, the bindings looks like this: bind (all the widgets inside childwindow) "eval $mdw_child($child_no,close_cmd)" bind (all the widgets inside childwindow) "mdw_child::hide $child_no" Other things to do are some more definitions for the cursor behavior at the several areas, will be done if I have some more time.