diff options
author | treectrl <treectrl> | 2005-03-29 21:22:46 (GMT) |
---|---|---|
committer | treectrl <treectrl> | 2005-03-29 21:22:46 (GMT) |
commit | c097002e09f532d3c2b870f2d0abb7d11e995364 (patch) | |
tree | 744afb637b85082405a0c98111fa4fc1704c1aac | |
parent | 620ff223fbb8d280925a88321b55c0d3dc4b6e34 (diff) | |
download | tktreectrl-c097002e09f532d3c2b870f2d0abb7d11e995364.zip tktreectrl-c097002e09f532d3c2b870f2d0abb7d11e995364.tar.gz tktreectrl-c097002e09f532d3c2b870f2d0abb7d11e995364.tar.bz2 |
Added TreeCtrl::PercentsCmd to perform %-substitution on dynamic events.
-rw-r--r-- | library/treectrl.tcl | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/library/treectrl.tcl b/library/treectrl.tcl index 9b8864e..e1fd3d2 100644 --- a/library/treectrl.tcl +++ b/library/treectrl.tcl @@ -435,8 +435,9 @@ proc ::TreeCtrl::Release1 {w x y} { $w column configure $Priv(column) -sunken no # Don't generate the event if it wasn't installed if {[lsearch -exact [$w notify eventnames] Header] != -1} { - $w notify generate <Header-invoke> [list T $w \ - C $Priv(column)] + $w notify generate <Header-invoke> \ + [list C $Priv(column)] \ + "::TreeCtrl::PercentsCmd $w" } } } @@ -921,3 +922,28 @@ proc ::TreeCtrl::ScanDrag {w x y} { } return } + +proc ::TreeCtrl::PercentsCmd {T char object event detail charMap} { + if {$detail ne ""} { + set pattern <$event-$detail> + } else { + set pattern <$event> + } + switch -- $char { + d { return $detail } + e { return $event } + P { return $pattern } + W { return $object } + T { return $T } + ? { + array set map $charMap + array set map [list T $T W $object P $pattern e $event d $detail] + return [array get map] + } + default { + array set map [list $char $char] + array set map $charMap + return $map($char) + } + } +} |