Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main > by-pkgid > e2a5fef11a7f55d2dc803b8b7498c8e5 > files > 658

ruby-tcltk-1.8.5-31.el5_9.x86_64.rpm

#!/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