diff options
author | fvogel <fvogelnew1@free.fr> | 2020-01-18 12:08:41 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2020-01-18 12:08:41 (GMT) |
commit | 3930846c8e8c238310cc93c4214f54ca4fc9e27b (patch) | |
tree | ac39bebd380beb5a94793a69e6dac5b003f9b0f6 | |
parent | e970d02a227279ca90ed80e99e330bbde75d0fd5 (diff) | |
parent | cfaf3bb262bde15d44e1fe6b640cce1eb165d891 (diff) | |
download | tk-3930846c8e8c238310cc93c4214f54ca4fc9e27b.zip tk-3930846c8e8c238310cc93c4214f54ca4fc9e27b.tar.gz tk-3930846c8e8c238310cc93c4214f54ca4fc9e27b.tar.bz2 |
Fix [2830360fff]: ttk::entry looses state invalid at focus events. Add non-regression test entry-10.1
-rw-r--r-- | generic/ttk/ttkEntry.c | 8 | ||||
-rw-r--r-- | tests/ttk/entry.test | 12 |
2 files changed, 18 insertions, 2 deletions
diff --git a/generic/ttk/ttkEntry.c b/generic/ttk/ttkEntry.c index 4862e99..352c53a 100644 --- a/generic/ttk/ttkEntry.c +++ b/generic/ttk/ttkEntry.c @@ -650,8 +650,12 @@ static int EntryRevalidate(Tcl_Interp *interp, Entry *entryPtr, VREASON reason) static void EntryRevalidateBG(Entry *entryPtr, VREASON reason) { Tcl_Interp *interp = entryPtr->core.interp; - if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) { - Tcl_BackgroundException(interp, TCL_ERROR); + VMODE vmode = entryPtr->entry.validate; + + if (EntryNeedsValidation(vmode, reason)) { + if (EntryRevalidate(interp, entryPtr, reason) == TCL_ERROR) { + Tcl_BackgroundException(interp, TCL_ERROR); + } } } diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test index 34795fe..8b5f490 100644 --- a/tests/ttk/entry.test +++ b/tests/ttk/entry.test @@ -312,4 +312,16 @@ test entry-9.1 "Index range invariants" -setup { destroy .e } +test entry-10.1 {Bug [2830360fff] - Don't loose invalid at focus events} -setup { + pack [ttk::entry .e] + update +} -body { + .e state invalid + set res [.e state] + event generate .e <FocusOut> + lappend res [.e state] +} -result {invalid invalid} -cleanup { + destroy .e +} + tcltest::cleanupTests |