Tcl/Tk Cookbook - Using Extensions


Step 2: zooming

Copy the Tcl script file features.tcl which is placed under ~cookbook/code/ch10. This script is part of the BLT distribution code and all copyright statements should be preserved.

You can either append the following three lines of script to your file bltex.tcl or you can issue these commands at the stcl prompt if you have invoked stcl interactively.


source features.tcl
SetZoom .g
SetActiveLegend .g

The result of the command SetActiveLegend .g is that as you move the mouse cursor within the legend window at the top right-hand corner, one or the other of the curves will turn to red depending on whether the mouse cursor is on legend 1 or legend 2.

SetZoom sets support for the user to select a rectangular region within the graph widget to zoom. The region is selected by pressing the left mouse button at the top left hand corner of the region and dragging the mouse, with button kept pressed, towards the bottom right and releasing the button at the end of the region of interest. The result of such an user action is: