Copyright © 2008, 2009 Arndt Roger Schneider
Using Gstripes directly is rather cumbersome, especially the initial response to the Map event.
I therefore wrote a set of support functions, which use the template infrastructure as their basis. The window array w gets used to locate the relevant windows, inside the given instance.
I recommend to use this infrastructure for each composition, whether it is a template or not. w is being used from the global namespace in response to an event. It must be encode in a namespace named after the the window class, but starting with a lower case character.
Example 6.24. Namespace and Window Class
namespace eval argus { array set w { 0 {} 1 .firstChld 2 .secondChld 3 .firstChld.grand } } proc argus {path args} { frame $path -class Argus ... }
The main Gstripes function for templates. This function looks into the Option Database if »stripes« is defined for the parent window and creates a new Gstripes window.
The stripes function accepts additional arguments. These arguments have to be the indices inside the w array.
substripes is a variation of stripes (see Chapter 6, Gstripes ). The first numerical argument to »substripes« indicates the child window, which will feature an independent Gstripes window.
»stripesmod« is called in response to a modification of one or many hijacked windows.
Example 6.26. Modifying hijacked windows
... .mycomposit$w(1) configure -state disabled stripesmod .mycomposit 1 ;# 2 3 also allowed!
Same as »stripesmod« (see Example 6.26, “Modifying hijacked windows”). First index identifies the affected parent window
Example 6.27. Mixed Stripes
... # base is the composite root window: stripes $base if { {aqua} != [tk windowingsystem] } { substripes $base 23 2 9 14 {15 16} } else { substripes $base 23 2 9 14 15 16 } substripes $base 22 1 25 7 8 foreach id { 24 27 } { stripes $base$w($id) } substripes $base 26 {28 - 29 + 31 - 32 33} 30 ...