summaryrefslogtreecommitdiff
path: root/ext/tk/sample
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/sample')
-rw-r--r--ext/tk/sample/demos-en/spin.rb7
-rw-r--r--ext/tk/sample/demos-jp/spin.rb7
2 files changed, 6 insertions, 8 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)
diff --git a/ext/tk/sample/demos-jp/spin.rb b/ext/tk/sample/demos-jp/spin.rb
index 909d2b4818..4f6edc13c0 100644
--- a/ext/tk/sample/demos-jp/spin.rb
+++ b/ext/tk/sample/demos-jp/spin.rb
@@ -57,11 +57,10 @@ australianCities = [
]
[
- # 現状の Ruby/Tk (現在のバージョンは 1.8.0) では、validate オプションや
- # それに関連するオプションへのサポートを十分に達成できていません。この
- # 問題については、次または将来のバージョンで改善する予定です。
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)