From: Pat Thoyts <patthoyts@users.sourceforge.net>
Date: Sat, 28 Nov 2020 13:01:08 +0000 (+0000)
Subject: windows_list: test for -background to avoid setting error in remote
X-Git-Url: http://test.brassandglass.co.uk/gitweb?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=tkinspect

windows_list: test for -background to avoid setting error in remote
---

diff --git a/windows_list.tcl b/windows_list.tcl
index 800d7bf..092f988 100644
--- a/windows_list.tcl
+++ b/windows_list.tcl
@@ -75,12 +75,13 @@ widget windows_list {
     }
     method retrieve {target window} {
         set result [$self retrieve_$slot(mode) $target $window]
-        if {[catch {
+        set hasbg [lsearch -exact -index 0 [send $target [list $window configure]] -background]
+        if {$hasbg != -1} {
             set old_bg [send $target [list $window cget -background]]
             send $target [list $window configure -background #ff69b4]
             send $target [list after 200 \
                 [list catch [list $window configure -background $old_bg]]]
-        }]} {
+        } else {
             # FIXME: for ttk items toggle state active?
             set restorestate [send $target [list $window state active]]
             send $target [list after 200 [list catch [list $window state $restorestate]]]