From: Roberto H. <ro...@ad...> - 2001-09-09 00:38:49
|
Hi all, I've been trying to learn more about the initialization process of the Tk driver. While doing that I came up with a couple of questions, maybe some= of you can help me out with these. I'm also including some things I figured = out (in case they are of any use to anyone). Here are my questions: 1. How can I get the plplot window to start out with the DEBUG menu enabl= ed when using the Tk driver? 2. When I use PLplot in Octave I can start the Tk driver and specify a Tc= l script and an empty frame to be used for the "plxframe". The script is executed AUTOMATICALLY when "plinit" is called. That way I can have a plo= t window as PART of another window. These are the commands that are used in Octave. =A0=A0=A0=A0=A0=A0=A0=A0 plSetOpt ("plwindow", plot_frame); =A0=A0=A0=A0=A0=A0=A0=A0 plSetOpt ("tk_file", init_file); How can I do the same without Octave? 3. When is the "plw_start" procedure in (plplotdir/lib/plplot5.0.4/tcl/plwidget.tcl) called? What I mean is what = API command calls it. I looked around but couldn't find out. 4. I have a suggestion for a small change in the procedure "plw_start" (h= ope this is the right list). The change and reason for it are specified at th= e end of this mail. ------------------------------------------- From what I've been able to tell, the most important procedures that are executed during the "tk" driver initialization process are: 1. plserver_init (plplotdir/lib/plplot5.0.4/tcl/plserver.tcl) - Sets up t= he top menubar with the File and Help menus =A0 =A0 =A0 =A0|| =A0 =A0 =A0 calls =A0 =A0 =A0 =A0v 2. plstdwin (plplotdir/lib/plplot5.0.4/tcl/pltools.tcl) - Runs the pldefa= luts and plconfig procedures to set up the options and sets the minimum window size and geometry. =A0 =A0 =A0 =A0 =A0(don't know who calls this, probably plinit) 3. plw_create (plplotdir/lib/plplot5.0.4/tcl/plwidget.tcl) =A0 =A0 =A0 =A0|| =A0 =A0 =A0 calls =A0 =A0 =A0 =A0v 4. plxframe (plplotdir/lib/plplot5.0.4/tcl/plwidget.tcl) - Creates a container frame (unless already specified) and puts the plot_menu and plf= rame (for the actual plot) inside it. =A0 =A0 =A0 =A0 =A0(don't know who calls this, probably plinit) 5. plw_start (plplotdir/lib/plplot5.0.4/tcl/plwidget.tcl) - Packs the container frame that was either specified by the user or created by "plxframe". Tells the client that the widget is ready. Calls a procedure "after_plw_start" which is optional code the user can write if he needs t= o execute anything after the driver initialization is done. ------------------------------------------ When the "plinit" command is called with the "tk" driver the procedure "plxframe" is used. This procedure creates a "container" frame and within that frame are the "plot_menu" (if enabled) and a "plframe". There is the option to specify a tcl script and an empty frame for the plxframe to be created in. The procedure that initializes the "tk" driver DOESN'T CHECK whether the specified container frame has been mapped or no= t. It just PACKS the frame. If the frame had been previoulsy mapped with a geometry manager other than PACK it causes the process to lock up. So here there are two options: a) Make sure all the widgets that are siblings of the specified "containe= r" frame are managed with PACK. b) Modify the procedure that initializes the "tk" driver to check whether= the specified container frame has been mapped or not before packing it. The procedure in charge of doing the packing is "plw_start" which is in t= he "plplotdir/lib/plplot5.0.4/tcl/plwidget.tcl" file. The change is as follo= ws: [old] # Manage widget hierarchy =A0 =A0 pack append [winfo parent $w] $w \ =A0 =A0 =A0 =A0{bottom expand fill} =A0 =A0 update [new] # Manage widget hierarchy =A0 =A0 if {! [winfo ismapped $w]} { =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0<--- only change =A0 =A0 =A0 =A0 pack append [winfo parent $w] $w \ =A0=A0=A0=A0=A0=A0=A0=A0 =A0 =A0 =A0 =A0{bottom expand fill} =A0 =A0 } =A0 =A0 update Regards, - Roberto |