summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjenglish <jenglish@flightlab.com>2006-12-17 21:09:46 (GMT)
committerjenglish <jenglish@flightlab.com>2006-12-17 21:09:46 (GMT)
commit7f57cc3e07cec7711ebfbd96b9a28af4e9f463c9 (patch)
tree2e4308ec8e352756daff81632e81c195674ebdef
parent916e70fb90cb972726e8e580ff8dabf5e3da7aa1 (diff)
downloadtk-7f57cc3e07cec7711ebfbd96b9a28af4e9f463c9.zip
tk-7f57cc3e07cec7711ebfbd96b9a28af4e9f463c9.tar.gz
tk-7f57cc3e07cec7711ebfbd96b9a28af4e9f463c9.tar.bz2
Add combobox -height option; only show scrollbar if the listbox
needs to scroll [#1032869].
-rw-r--r--ChangeLog6
-rw-r--r--doc/ttk_combobox.n4
-rw-r--r--generic/ttk/ttkEntry.c7
-rw-r--r--library/ttk/combobox.tcl9
4 files changed, 21 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 38923b7..79a8be8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-17 Joe English <jenglish@users.sourceforge.net>
+
+ * library/ttk/combobox.tcl, generic/ttk/ttkEntry.c,
+ doc/ttk_combobox.n: Add combobox -height option; only
+ show scrollbar if the listbox needs to scroll [#1032869].
+
2006-12-16 Mo DeJong <mdejong@users.sourceforge.net>
* doc/cursors.n: Mention "none" in supported
diff --git a/doc/ttk_combobox.n b/doc/ttk_combobox.n
index 5f08b04..eaa3f69 100644
--- a/doc/ttk_combobox.n
+++ b/doc/ttk_combobox.n
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: ttk_combobox.n,v 1.3 2006/12/13 23:04:32 hobbs Exp $
+'\" RCS: @(#) $Id: ttk_combobox.n,v 1.4 2006/12/17 21:09:46 jenglish Exp $
'\"
.so man.macros
.TH ttk_combobox n 8.5 Tk "Tk Themed Widget"
@@ -32,6 +32,8 @@ If set, the widget selection is linked to the X selection.
.OP \-justify justify Justify
Specifies how the text is aligned within the widget.
One of \fBleft\fR, \fBcenter\fR, or \fBright\fR.
+.OP \-height height Height
+Specifies the height of the pop-down listbox, in rows.
.OP \-postcommand postCommand PostCommand
A Tcl script to evaluate immediately before displaying the listbox.
The \fB-postcommand\fR script may specify the \fB-values\fR to display.
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c
index c7a7a2f..157962e 100644
--- a/generic/ttk/ttkEntry.c
+++ b/generic/ttk/ttkEntry.c
@@ -1,5 +1,5 @@
/*
- * $Id: ttkEntry.c,v 1.3 2006/12/14 19:51:04 jenglish Exp $
+ * $Id: ttkEntry.c,v 1.4 2006/12/17 21:09:46 jenglish Exp $
*
* DERIVED FROM: tk/generic/tkEntry.c r1.35.
*
@@ -156,6 +156,7 @@ typedef struct
#define DEF_INSERT_BG "black"
#define DEF_ENTRY_WIDTH "20"
#define DEF_ENTRY_FONT "TkTextFont"
+#define DEF_LIST_HEIGHT "10"
static Tk_OptionSpec EntryOptionSpecs[] =
{
@@ -1679,6 +1680,7 @@ static WidgetSpec EntryWidgetSpec =
typedef struct {
Tcl_Obj *postCommandObj;
Tcl_Obj *valuesObj;
+ Tcl_Obj *heightObj;
int currentIndex;
} ComboboxPart;
@@ -1690,6 +1692,9 @@ typedef struct {
static Tk_OptionSpec ComboboxOptionSpecs[] =
{
+ {TK_OPTION_STRING, "-height", "height", "Height",
+ DEF_LIST_HEIGHT, Tk_Offset(Combobox, combobox.heightObj), -1,
+ 0,0,0 },
{TK_OPTION_STRING, "-postcommand", "postCommand", "PostCommand",
"", Tk_Offset(Combobox, combobox.postCommandObj), -1,
0,0,0 },
diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl
index 6c7099c..5af7a2d 100644
--- a/library/ttk/combobox.tcl
+++ b/library/ttk/combobox.tcl
@@ -1,5 +1,5 @@
#
-# $Id: combobox.tcl,v 1.2 2006/11/27 06:53:55 jenglish Exp $
+# $Id: combobox.tcl,v 1.3 2006/12/17 21:09:46 jenglish Exp $
#
# Ttk widget set: combobox bindings.
#
@@ -275,8 +275,11 @@ proc ttk::combobox::Post {cb} {
$popdown.l see $current
# Should allow user to control listbox height
set height [llength $values]
- if {$height > 10} {
- set height 10
+ if {$height > [$cb cget -height]} {
+ set height [$cb cget -height]
+ grid $popdown.sb
+ } else {
+ grid remove $popdown.sb
}
$popdown.l configure -height $height
update idletasks