~ubuntu-branches/ubuntu/hardy/ruby1.8/hardy-updates

« back to all changes in this revision

Viewing changes to ext/tk/sample/tkextlib/iwidgets/sample/entryfield-2.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env ruby
 
2
#########################################################
 
3
#
 
4
#  set $KCODE to 'utf' for a utf8 charecter
 
5
#
 
6
#########################################################
 
7
$KCODE='utf'
 
8
 
 
9
require 'tk'
 
10
require 'tkextlib/iwidgets'
 
11
 
 
12
TkOption.add('*textBackground', 'white')
 
13
 
 
14
ef  = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"})
 
15
 
 
16
fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:', 
 
17
                                   :fixed=>10, :width=>12)
 
18
 
 
19
nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:', 
 
20
                                   :validate=>:numeric, :width=>12)
 
21
 
 
22
aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:', 
 
23
                                   :validate=>:alphabetic, :width=>12, 
 
24
                                   :invalid=>proc{
 
25
                                     puts "Alphabetic contents invalid"
 
26
                                   })
 
27
 
 
28
pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12, 
 
29
                                   :show=>"\267",  ## <=== utf8 character
 
30
                                   :command=>proc{puts "Return Pressed"})
 
31
 
 
32
Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef)
 
33
 
 
34
ef.pack(:fil=>:x,  :expand=>true, :padx=>10, :pady=>5)
 
35
fef.pack(:fil=>:x,  :expand=>true, :padx=>10, :pady=>5)
 
36
nef.pack(:fil=>:x,  :expand=>true, :padx=>10, :pady=>5)
 
37
aef.pack(:fil=>:x,  :expand=>true, :padx=>10, :pady=>5)
 
38
pef.pack(:fil=>:x,  :expand=>true, :padx=>10, :pady=>5)
 
39
 
 
40
Tk.mainloop