1 2 3# 4# This software is Copyright by the Board of Trustees of Michigan 5# State University (c) Copyright 2005. 6# 7# You may use this software under the terms of the GNU public license 8# (GPL) ir the Tcl BSD derived license The terms of these licenses 9# are described at: 10# 11# GPL: http://www.gnu.org/licenses/gpl.txt 12# Tcl: http://www.tcl.tk/softare/tcltk/license.html 13# Start with the second paragraph under the Tcl/Tk License terms 14# as ownership is solely by Board of Trustees at Michigan State University. 15# 16# Author: 17# Ron Fox 18# NSCL 19# Michigan State University 20# East Lansing, MI 48824-1321 21# 22 23# 24# bindDown is a simple package that allows the user to attach 25# bind tags to a hieararchy of widgets starting with the top of 26# a widget tree. The most common use of this is in snit::widgets 27# to allow a binding to be placed on the widget itself e.g: 28# bindDown $win $win 29# 30# where the first item is the top of the widget tree, the second the 31# bindtag to add to each widget in the subtree. 32# This will allow bind $win <yada> yada to apply to the widget 33# children. 34# 35# 36package provide bindDown 1.0 37 38proc bindDown {top tag} { 39 foreach widget [winfo children $top] { 40 set wtags [bindtags $widget] 41 lappend wtags $tag 42 bindtags $widget [lappend wtags $tag] 43 bindDown $widget $tag 44 } 45} 46