summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authortreectrl <treectrl>2008-07-21 18:36:41 (GMT)
committertreectrl <treectrl>2008-07-21 18:36:41 (GMT)
commitdf5c976aa88acc56a303411ae481f9c1c89f4f69 (patch)
tree77f63f4dfe9019450428fe5905b014e177e0759b /library
parent8fa563c91c4fb1481c5d55485f88a803798adaf0 (diff)
downloadtktreectrl-df5c976aa88acc56a303411ae481f9c1c89f4f69.zip
tktreectrl-df5c976aa88acc56a303411ae481f9c1c89f4f69.tar.gz
tktreectrl-df5c976aa88acc56a303411ae481f9c1c89f4f69.tar.bz2
The <Left> and <Right> arrow keys expand/collapse the current item if -orient=vertical and -wrap={}.
Diffstat (limited to 'library')
-rw-r--r--library/treectrl.tcl14
1 files changed, 11 insertions, 3 deletions
diff --git a/library/treectrl.tcl b/library/treectrl.tcl
index e2e2dee..c63dd6a 100644
--- a/library/treectrl.tcl
+++ b/library/treectrl.tcl
@@ -1,4 +1,4 @@
-# RCS: @(#) $Id: treectrl.tcl,v 1.39 2006/12/07 03:47:01 treectrl Exp $
+# RCS: @(#) $Id: treectrl.tcl,v 1.40 2008/07/21 18:36:41 treectrl Exp $
bind TreeCtrl <Motion> {
TreeCtrl::CursorCheck %W %x %y
@@ -53,7 +53,11 @@ bind TreeCtrl <Shift-KeyPress-Down> {
TreeCtrl::Extend %W below
}
bind TreeCtrl <KeyPress-Left> {
- TreeCtrl::SetActiveItem %W [TreeCtrl::LeftRight %W active -1]
+ if {[%W cget -orient] eq "vertical" && [%W cget -wrap] eq ""} {
+ %W item collapse [%W item id active]
+ } else {
+ TreeCtrl::SetActiveItem %W [TreeCtrl::LeftRight %W active -1]
+ }
}
bind TreeCtrl <Shift-KeyPress-Left> {
TreeCtrl::Extend %W left
@@ -62,7 +66,11 @@ bind TreeCtrl <Control-KeyPress-Left> {
%W xview scroll -1 pages
}
bind TreeCtrl <KeyPress-Right> {
- TreeCtrl::SetActiveItem %W [TreeCtrl::LeftRight %W active 1]
+ if {[%W cget -orient] eq "vertical" && [%W cget -wrap] eq ""} {
+ %W item expand [%W item id active]
+ } else {
+ TreeCtrl::SetActiveItem %W [TreeCtrl::LeftRight %W active 1]
+ }
}
bind TreeCtrl <Shift-KeyPress-Right> {
TreeCtrl::Extend %W right