1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/tk/sample/tkextlib/iwidgets/sample/entryfield-1.rb
nagai 3514110b89 * ext/tk/lib/tk/*: untabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-11 04:51:21 +00:00

39 lines
1.5 KiB
Ruby

#!/usr/bin/env ruby
#########################################################
#
# use Tk::UTF8_String() for a utf8 charecter
#
#########################################################
require 'tk'
require 'tkextlib/iwidgets'
TkOption.add('*textBackground', 'white')
ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"})
fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:',
:fixed=>10, :width=>12)
nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:',
:validate=>:numeric, :width=>12)
aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:',
:validate=>:alphabetic, :width=>12,
:invalid=>proc{
puts "Alphabetic contents invalid"
})
pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12,
:show=>Tk::UTF8_String("\267"),
## <=== utf8 character
:command=>proc{puts "Return Pressed"})
Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef)
ef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
fef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
nef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
aef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
pef.pack(:fil=>:x, :expand=>true, :padx=>10, :pady=>5)
Tk.mainloop