gitk: Improve behaviour of drop-down lists
The drop-down lists used for things like the criteria for finding commits (containing/touching paths/etc.) use a combobox if we are using the ttk widgets. By default the combobox exports its value as the selection when it is changed, which is unnecessary, and sometimes the combobox wouldn't release the selection, which is annoying. To fix this, we make these comboboxes not export their selection, and also clear their selection whenever they are changed. This makes them more like a simple selection of alternatives, improving the look and feel of gitk. Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras committed
May 11, 2013 at 17:08 UTC
39c126914b4b7365251f32d34926506c229f090e
1 file changed
+6
-1
gitk
+6
-1
@@ -1998,6 +1998,9 @@ proc mca {str} {
1998
return [string map {&& & & {}} [mc $str]]
1999
}
2000
2001
+proc cleardropsel {w} {
2002
+ $w selection clear
2003
+}
2004
proc makedroplist {w varname args} {
2005
global use_ttk
2006
if {$use_ttk} {
@@ -2007,7 +2010,9 @@ proc makedroplist {w varname args} {
2010
if {$cx > $width} {set width $cx}
2011
}
2012
set gm [ttk::combobox $w -width $width -state readonly\
2010
- -textvariable $varname -values $args]
2013
+ -textvariable $varname -values $args \
2014
+ -exportselection false]
2015
+ bind $gm <<ComboboxSelected>> [list $gm selection clear]
2016
} else {
2017
set gm [eval [linsert $args 0 tk_optionMenu $w $varname]]
2018
}