chiark / gitweb /
Permit Return instead of clicking on pixmap selection
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 4 Jul 2009 20:02:15 +0000 (21:02 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 4 Jul 2009 20:02:15 +0000 (21:02 +0100)
pctb/dictionary-manager

index c1e983b6b35e7c65d2ea9223f4413b5c52936b22..ad05c6b1760b343571a1bb3b052b57f17c2b8f82 100755 (executable)
@@ -145,6 +145,7 @@ static unsigned char csr_bits[] = {
 
     button .pe.ok -text OK
     pack .pe.grid .pe.ok -side left
+    bind .pe.ok <Key-Return> { .pe.ok invoke }
 
     pack .d.mi .d.ctx -side top -anchor w
     pack .d -fill x -padx 2 -pady 2
@@ -366,7 +367,9 @@ proc pixmap_select {ncol} {
        if {$col==$ncol} continue
        .pe.grid.l$col selection clear 0 end
     }
-    pixmap_maybe_ok
+    if {[pixmap_maybe_ok]} {
+       focus .pe.ok
+    }
 }
 proc pixmap_maybe_ok {} {
     global alloptions pixmap_selcol pixmap_selrow
@@ -382,8 +385,10 @@ proc pixmap_maybe_ok {} {
     if {$nsel==1} {
        debug "MAYBE_OK YES col=$pixmap_selcol row=$pixmap_selrow."
        .pe.ok configure -state normal -command pixmap_ok
+       return 1
     } else {
        .pe.ok configure -state disabled -command {}
+       return 0
     }
 }
 proc pixmap_ok {} {
@@ -452,7 +457,7 @@ proc required/pixmap {} {
     pixmap_maybe_ok
     
     helptext {
-       {{Indicate the meaning of this image, and click OK.}}
+       {{Indicate the meaning of this image; then click OK or hit Return.}}
     }
 }