frame .f-list
frame .f-buttons
-button .b-anagram -text "Anagram" -underline 0 \
- -command { run-search "-anagram" $word }
-button .b-subgram -text "Subgram" -underline 0 \
- -command { run-search "-subgram" $word }
-button .b-glob -text "Crossword" -underline 5 \
- -command { run-search "-wildcard" $word }
-button .b-track -text "Trackword" -underline 0 \
- -command { run-search "-trackword" $word }
-button .b-regexp -text "Regexp" -underline 0 \
- -command { run-search "-regexp" $word }
+foreach {opt text mnem} {
+ anagram Anagram a
+ subgram Subgram s
+ wildcard Crossword w
+ trackword Trackword t
+ mono Monoalphabetic m
+ regexp "Regular expression" r
+ pcre "Perl regexp" p
+} {
+ button .b-$opt -text $text \
+ -underline [string first $mnem [string tolower $text]] \
+ -command [concat [list run-search -$opt] \$word]
+ bind . <Alt-$mnem> [list tkButtonInvoke .b-$opt]
+ pack .b-$opt -in .f-buttons -fill x -padx 2 -pady 2
+}
button .b-custom -text "Custom" -underline 0 \
-command { run-search-v [wordlist $word] }
+bind . <Alt-c> { tkButtonInvoke .b-custom }
+pack .b-custom -in .f-buttons -fill x -padx 2 -pady 2
listbox .list \
-xscrollcommand { .f-list.xscroll set } \
grid rowconfigure .f-list 0 -weight 1
grid columnconfigure .f-list 0 -weight 1
-pack .b-custom .b-track .b-regexp .b-glob .b-subgram .b-anagram \
- -in .f-buttons -fill x -padx 2 -pady 2
-
pack .e-word -in .f-entry -expand yes -fill x -padx 2 -pady 2
pack .f-entry -fill x
focus .e-word
bind .e-word <Return> { tkButtonInvoke .b-anagram }
-bind . <Alt-a> { tkButtonInvoke .b-anagram }
-bind . <Alt-t> { tkButtonInvoke .b-track }
-bind . <Alt-s> { tkButtonInvoke .b-subgram }
-bind . <Alt-w> { tkButtonInvoke .b-glob }
-bind . <Alt-r> { tkButtonInvoke .b-regexp }
-bind . <Alt-c> { tkButtonInvoke .b-custom }