Tk Library Source Code

View Ticket
Login
Ticket UUID: 435097
Title: Keynavigation failed in Tree
Type: Bug Version: None
Submitter: svogel Created on: 2001-06-21 12:42:05
Subsystem: bwidget Assigned To: ericm
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2001-06-22 08:57:32
Resolution: Fixed Closed By: ericm
    Closed on: 2001-06-22 01:57:32
Description:
Having supplied open/close-commands for the tree-
widget, they are not called when pressing the "Right"-
Button or the "Left"-Button.

This can be especially observed in the directory-tree-
demo, where the subtree is build in the "open-
callback"-command. Pressing the "Right"-Key doesn't 
open the tree, because the "open-command" isn't called.

The following could be inserted in tree.tcl for 
proc Tree::_keynav {which win} {
 ...
  "right" {
  # On a right arrow, if the current node is closed, 
open it.
  # If the current node is open, go to its first child
  if { [string equal $node ""] } {
    return
  }
  set open [$win itemcget $node -open]
  # patch begin -->
  if {!$open && [set cmd [Widget::getoption $win -
opencmd]] != ""} {
    uplevel \#0 $cmd $node
   }
   # <-- patch end
   if { [llength [$win nodes $node]] } {
   ...


  "left" {
  # On a left arrow, if the current node is open, 
close it.
  # If the current node is closed, go to its parent.
  if { [string equal $node ""] } {
    return
  }
  set open [$win itemcget $node -open]
  if { $open } {
    $win itemconfigure $node -open 0
    # patch begin -->
    if {[set cmd [Widget::getoption $win -closecmd]] !
= ""} {
      # call close-callback
      uplevel \#0 $cmd $node
    }
    # <-- patch end
    return
  } else {
  ...



Best regards
  Stefan
User Comments: ericm added on 2001-06-22 08:57:32:
Logged In: YES 
user_id=86324

* tree.tcl: Corrected keyboard navigation so that open/close
commands are invoked when right/left arrows are used to
open/close
nodes, patch from [Bug #435097].  Also corrected keyboard
navigation on right arrow press; previously only opened
closed
nodes that had children, but should always open nodes,
regardless
of whether it has children.