summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk/scale.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib/tk/scale.rb')
-rw-r--r--ext/tk/lib/tk/scale.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/ext/tk/lib/tk/scale.rb b/ext/tk/lib/tk/scale.rb
index bf2791ec55..7e758d92f4 100644
--- a/ext/tk/lib/tk/scale.rb
+++ b/ext/tk/lib/tk/scale.rb
@@ -26,9 +26,16 @@ class Tk::Scale<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