Tk Library Source Code

Artifact [92d037b22e]
Login

Artifact 92d037b22e9a6faee6d41657ca03451b8f30f051:

Attachment "bwidget.449284.diff" to ticket [449284ffff] added by andreas_kupries 2001-08-09 03:56:20.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcllib/bwidget/ChangeLog,v
retrieving revision 1.54
diff -u -r1.54 ChangeLog
--- ChangeLog	2001/08/08 20:42:02	1.54
+++ ChangeLog	2001/08/08 20:55:08
@@ -1,5 +1,11 @@
 2001-08-08  Andreas Kupries <[email protected]>
 
+	* tree.tcl (Tree::_keynav): Added code to call the open and close
+	  commands when the open-status of a node is toggled with the
+	  space bar. Bug [449284].
+
+2001-08-08  Andreas Kupries <[email protected]>
+
 	* color.tcl: Added the missing definition of the main
 	  'SelectColor' procedure. This prevented users from creating
 	  these widgets in the documented way. Bug [449276].
Index: tree.tcl
===================================================================
RCS file: /cvsroot/tcllib/bwidget/tree.tcl,v
retrieving revision 1.32
diff -u -r1.32 tree.tcl
--- tree.tcl	2001/06/22 01:56:50	1.32
+++ tree.tcl	2001/08/08 20:55:08
@@ -1794,7 +1794,24 @@
 	    }
 	    set open [$win itemcget $node -open]
 	    if { [llength [$win nodes $node]] } {
+
+		# Toggle the open status of the chosen node.
+
 		$win itemconfigure $node -open [expr {$open?0:1}]
+
+		if {$open} {
+		    # Node was open, is now closed. Call the close-cmd
+
+		    if { [set cmd [Widget::getoption $win -closecmd]] != "" } {
+			uplevel \#0 $cmd $node
+		    }
+		} else {
+		    # Node was closed, is now open. Call the open-cmd
+
+		    if { [set cmd [Widget::getoption $win -opencmd]] != "" } {
+			uplevel \#0 $cmd $node
+		    }
+                }
 	    }
 	}
     }