diff options
Diffstat (limited to 'ext/tk/lib/tk/scrollbar.rb')
-rw-r--r-- | ext/tk/lib/tk/scrollbar.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/tk/lib/tk/scrollbar.rb b/ext/tk/lib/tk/scrollbar.rb index 521fc7e400..87db46a9f9 100644 --- a/ext/tk/lib/tk/scrollbar.rb +++ b/ext/tk/lib/tk/scrollbar.rb @@ -31,9 +31,16 @@ class Tk::Scrollbar<TkWindow tk_call_without_enc(self.class::TkCommandNames[0], @path) keys = __check_available_configure_options(keys) unless keys.empty? - tk_call_without_enc('destroy', @path) - tk_call_without_enc(self.class::TkCommandNames[0], @path, - *hash_kv(keys, true)) + begin + tk_call_without_enc('destroy', @path) + rescue + # cannot destroy + configure(keys) + else + # re-create widget + tk_call_without_enc(self.class::TkCommandNames[0], @path, + *hash_kv(keys, true)) + end end end end |