diff options
Diffstat (limited to 'ext/tk/sample/demos-en/spin.rb')
-rw-r--r-- | ext/tk/sample/demos-en/spin.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/tk/sample/demos-en/spin.rb b/ext/tk/sample/demos-en/spin.rb index 882772ad4d..5d32454170 100644 --- a/ext/tk/sample/demos-en/spin.rb +++ b/ext/tk/sample/demos-en/spin.rb @@ -53,11 +53,10 @@ australianCities = [ ] [ - # Current version of Ruby/Tk (current is 1.8.0) is not enough - # to support 'validate' option and related options. This problem - # will be improved in the next or future version. TkSpinbox.new($spin_demo, :from=>1, :to=>10, :width=>10, :validate=>:key, - :validatecommand=>"string is integer %P"), + :validatecommand=>[ + proc{|s| s == '' || /^[+-]?\d+$/ =~ s }, '%P' + ]), TkSpinbox.new($spin_demo, :from=>0, :to=>3, :increment=>0.5, :format=>'%05.2f', :width=>10), TkSpinbox.new($spin_demo, :values=>australianCities, :width=>10) |