File: bindDown.tcl

package info (click to toggle)
tklib 0.6-1%2Bdeb8u1
  • links: PTS
  • area: main
  • in suites: jessie
  • size: 16,112 kB
  • ctags: 4,008
  • sloc: tcl: 65,204; sh: 6,870; ansic: 792; pascal: 359; makefile: 73; exp: 21; sed: 16
file content (45 lines) | stat: -rwxr-xr-x 1,365 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45


#
#    This software is Copyright by the Board of Trustees of Michigan
#    State University (c) Copyright 2005.
#
#    You may use this software under the terms of the GNU public license
#    (GPL) ir the Tcl BSD derived license  The terms of these licenses
#     are described at:
#
#     GPL:  http://www.gnu.org/licenses/gpl.txt
#     Tcl:  http://www.tcl.tk/softare/tcltk/license.html
#     Start with the second paragraph under the Tcl/Tk License terms
#     as ownership is solely by Board of Trustees at Michigan State University.
#
#     Author:
#             Ron Fox
#	     NSCL
#	     Michigan State University
#	     East Lansing, MI 48824-1321
#

#
# bindDown is a simple package that allows the user to attach
# bind tags to a hieararchy of widgets starting with the top of
# a widget tree.  The most common use of this is in snit::widgets
# to allow a binding to be placed on the widget itself e.g:
#  bindDown $win $win
#
#   where the first item is the top of the widget tree, the second the
#   bindtag to add to each widget in the subtree.
#   This will allow bind $win <yada> yada to apply to the widget
#   children.
#
#
package provide bindDown 1.0

proc bindDown {top tag} {
    foreach widget [winfo children $top] {
	set wtags [bindtags $widget]
	lappend   wtags $tag
	bindtags $widget [lappend wtags $tag]
	bindDown $widget $tag
    }
}