Add trigger method and binding for space so keyboard usage works.
authorsls <sls>
Sun, 4 Jun 1995 08:06:33 +0000 (08:06 +0000)
committersls <sls>
Sun, 4 Jun 1995 08:06:33 +0000 (08:06 +0000)
lists.tcl

index c5afebd2af6c95be4ab81db3199897d947cb3a2d..f42b9a7b6ca34a9eb5b24740b61bd56c0a9c841c 100644 (file)
--- a/lists.tcl
+++ b/lists.tcl
@@ -148,6 +148,7 @@ widget tkinspect_list {
        listbox $self.list -relief sunken -exportselection 0 \
            -yscroll "$self.sb set" -selectmode single
        bind $self.list <1> "$self click %x %y; continue"
+       bind $self.list <Key-space> "$self trigger; continue"
        pack $self.sb -side right -fill y
        pack $self.list -side right -fill both -expand yes
        set slot(menu) [$slot(main) add_menu $slot(title)]
@@ -202,6 +203,11 @@ widget tkinspect_list {
     method click {x y} {
        $self run_command [$self.list get @$x,$y]
     }
+    method trigger {} {
+       set selection [$self.list curselection]
+       if ![llength $selection] return
+       $self run_command [$self.list get [lindex $selection 0]]
+    }
     method run_command {item} {
        if [string length $slot(command)] {
            set slot(current_item) $item