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)]
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