From: sls Date: Sun, 4 Jun 1995 08:06:33 +0000 (+0000) Subject: Add trigger method and binding for space so keyboard usage works. X-Git-Tag: r5_1_1~23 X-Git-Url: http://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=bc922b6a530c174a99691035f45e3fb50d665840;p=tkinspect Add trigger method and binding for space so keyboard usage works. --- diff --git a/lists.tcl b/lists.tcl index c5afebd..f42b9a7 100644 --- 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 "$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