From 6654ca14fff1fe29caf02e626fb790df3104bd91 Mon Sep 17 00:00:00 2001 From: jenglish Date: Sat, 23 Feb 2008 18:41:03 +0000 Subject: Arrange to deliver <> event after listbox is unposted, as intended [Bug 1890211]. Clarified documentation. --- ChangeLog | 7 +++++++ doc/ttk_combobox.n | 5 +++-- library/ttk/combobox.tcl | 4 ++-- tests/ttk/combobox.test | 24 ++++++++++++++++++++++-- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24dd3d2..734888a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2008-02-23 Joe English + * library/ttk/combobox.tcl, doc/ttk_combobox.n, + tests/ttk/combobox.test: Arrange to deliver <> + event after listbox is unposted, as intended [Bug 1890211]. + Clarified documentation. + +2008-02-23 Joe English + * generic/ttk/ttkPanedWindow.c: Don't enforce minimum sash thickness of 5 pixels, just use 5 as a default [FR 1898288] diff --git a/doc/ttk_combobox.n b/doc/ttk_combobox.n index e9e1dc7..9f3b83a 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.14 2008/01/29 15:38:00 dkf Exp $ +'\" RCS: @(#) $Id: ttk_combobox.n,v 1.15 2008/02/23 18:41:06 jenglish Exp $ '\" .so man.macros .TH ttk::combobox n 8.5 Tk "Tk Themed Widget" @@ -99,7 +99,8 @@ widget commands (see \fIttk::entry(n)\fR for details): .SH "VIRTUAL EVENTS" The combobox widget generates a \fB<>\fR virtual event when the user selects an element from the list of values. -This event is generated after the listbox is unposted. +If the selection action unposts the listbox, +this event is delivered after the listbox is unposted. .SH "SEE ALSO" ttk::widget(n), ttk::entry(n) .SH KEYWORDS diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index 401548c..2f4838f 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -1,5 +1,5 @@ # -# $Id: combobox.tcl,v 1.11 2007/12/13 15:27:08 dgp Exp $ +# $Id: combobox.tcl,v 1.12 2008/02/23 18:41:07 jenglish Exp $ # # Combobox bindings. # @@ -169,7 +169,7 @@ proc ttk::combobox::SelectEntry {cb index} { $cb current $index $cb selection range 0 end $cb icursor end - event generate $cb <> + event generate $cb <> -when mark } ## Scroll -- Mousewheel binding diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test index 3c20bd3..8f25a81 100644 --- a/tests/ttk/combobox.test +++ b/tests/ttk/combobox.test @@ -1,5 +1,5 @@ # -# Tile package: combobox widget tests +# ttk::combobox widget tests # package require Tk 8.5 @@ -43,6 +43,26 @@ test combobox-2.4 "current -- value not in list" -body { .cb current } -result -1 -test combobox-end "Cleanup" -body { destroy .cb } +test combobox-2.end "Cleanup" -body { destroy .cb } + + +test combobox-1890211 "ComboboxSelected event after listbox unposted" -body { + # whitebox test... + pack [ttk::combobox .cb -values [list a b c]] + set result [list] + bind .cb <> { + lappend result Event [winfo ismapped .cb.popdown] [.cb get] + } + lappend result Start 0 [.cb get] + ttk::combobox::Post .cb + lappend result Post [winfo ismapped .cb.popdown] [.cb get] + .cb.popdown.l selection clear 0 end; .cb.popdown.l selection set 1 + ttk::combobox::LBSelected .cb.popdown.l + lappend result Select [winfo ismapped .cb.popdown] [.cb get] + update + set result +} -result [list Start 0 {} Post 1 {} Select 0 b Event 0 b] -cleanup { + destroy .cb +} tcltest::cleanupTests -- cgit v0.12