summaryrefslogtreecommitdiff
path: root/ext/tk/sample/tkextlib/bwidget/basic.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/sample/tkextlib/bwidget/basic.rb')
-rw-r--r--ext/tk/sample/tkextlib/bwidget/basic.rb96
1 files changed, 48 insertions, 48 deletions
diff --git a/ext/tk/sample/tkextlib/bwidget/basic.rb b/ext/tk/sample/tkextlib/bwidget/basic.rb
index c1521651fd..060baf8a6c 100644
--- a/ext/tk/sample/tkextlib/bwidget/basic.rb
+++ b/ext/tk/sample/tkextlib/bwidget/basic.rb
@@ -29,37 +29,37 @@ module DemoBasic
end
def self._label(parent)
- lab = Tk::BWidget::Label.new(parent, :text=>'This is a Label widget',
+ lab = Tk::BWidget::Label.new(parent, :text=>'This is a Label widget',
:helptext=>'Label widget')
- chk = TkCheckbutton.new(parent, :text=>'Disabled',
- :variable=>@@var.ref(lab, 'state'),
- :onvalue=>'disabled', :offvalue=>'normal',
+ chk = TkCheckbutton.new(parent, :text=>'Disabled',
+ :variable=>@@var.ref(lab, 'state'),
+ :onvalue=>'disabled', :offvalue=>'normal',
:command=>proc{lab[:state] = @@var[lab, 'state']})
lab.pack(:anchor=>:w, :pady=>4)
chk.pack(:anchor=>:w)
end
def self._entry(parent)
- ent = Tk::BWidget::Entry.new(parent, :text=>'Press enter',
- :helptext=>'Entry widtet',
+ ent = Tk::BWidget::Entry.new(parent, :text=>'Press enter',
+ :helptext=>'Entry widtet',
:command=>proc{
@@var['entcmd'] = 'command called'
Tk.after(500, proc{@@var['entcmd'] = ''})
})
- chk1 = TkCheckbutton.new(parent, :text=>'Disabled',
- :variable=>@@var.ref(ent, 'state'),
- :onvalue=>'disabled', :offvalue=>'normal',
+ chk1 = TkCheckbutton.new(parent, :text=>'Disabled',
+ :variable=>@@var.ref(ent, 'state'),
+ :onvalue=>'disabled', :offvalue=>'normal',
:command=>proc{ent.state = @@var[ent, 'state']})
- chk2 = TkCheckbutton.new(parent, :text=>'Non editable',
- :variable=>@@var.ref(ent, 'editable'),
- :onvalue=>false, :offvalue=>true,
+ chk2 = TkCheckbutton.new(parent, :text=>'Non editable',
+ :variable=>@@var.ref(ent, 'editable'),
+ :onvalue=>false, :offvalue=>true,
:command=>proc{
ent.editable = @@var[ent, 'editable']
})
- lab = TkLabel.new(parent, :textvariable=>@@var.ref('entcmd'),
+ lab = TkLabel.new(parent, :textvariable=>@@var.ref('entcmd'),
:foreground=>'red')
ent.pack(:pady=>4, :anchor=>:w)
@@ -69,22 +69,22 @@ module DemoBasic
def self._button(parent)
frame = TkFrame.new(parent)
- but = Tk::BWidget::Button.new(frame, :text=>'Press me!',
- :repeatdelay=>300,
- :command=>proc{_butcmd('command')},
+ but = Tk::BWidget::Button.new(frame, :text=>'Press me!',
+ :repeatdelay=>300,
+ :command=>proc{_butcmd('command')},
:helptext=>'This is a Button widget')
sep1 = Tk::BWidget::Separator.new(frame, :orient=>:vertical)
- arr1 = Tk::BWidget::ArrowButton.new(frame, :type=>:button,
- :width=>25, :height=>25, :repeatdelay=>300,
- :command=>proc{_butcmd('command')},
+ arr1 = Tk::BWidget::ArrowButton.new(frame, :type=>:button,
+ :width=>25, :height=>25, :repeatdelay=>300,
+ :command=>proc{_butcmd('command')},
:helptext=>"This is an ArrowButton widget\nof type button")
sep2 = Tk::BWidget::Separator.new(frame, :orient=>:vertical)
- arr2 = Tk::BWidget::ArrowButton.new(frame, :type=>:arrow,
- :width=>25, :height=>25, :relief=>:sunken,
- :ipadx=>0, :ipady=>0, :repeatdelay=>300,
- :command=>proc{_butcmd('command')},
+ arr2 = Tk::BWidget::ArrowButton.new(frame, :type=>:arrow,
+ :width=>25, :height=>25, :relief=>:sunken,
+ :ipadx=>0, :ipady=>0, :repeatdelay=>300,
+ :command=>proc{_butcmd('command')},
:helptext=>"This is an ArrowButton widget\nof type arrow")
but.pack(:side=>:left, :padx=>4)
@@ -94,49 +94,49 @@ module DemoBasic
arr2.pack(:side=>:left, :padx=>4)
frame.pack
- Tk::BWidget::Separator.new(parent,
+ Tk::BWidget::Separator.new(parent,
:orient=>:horizontal).pack(:fill=>:x, :pady=>10)
- labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Command',
- :side=>:top, :anchor=>:w,
+ labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Command',
+ :side=>:top, :anchor=>:w,
:relief=>:sunken, :borderwidth=>1)
subf = labf1.get_frame
- chk1 = TkCheckbutton.new(subf, :text=>'Disabled',
- :variable=>@@var.ref('bstate'),
- :onvalue=>'disabled', :offvalue=>'normal',
- :command=>proc{_bstate(@@var['bstate'],
+ chk1 = TkCheckbutton.new(subf, :text=>'Disabled',
+ :variable=>@@var.ref('bstate'),
+ :onvalue=>'disabled', :offvalue=>'normal',
+ :command=>proc{_bstate(@@var['bstate'],
but, arr1, arr2)})
- chk2 = TkCheckbutton.new(subf, :text=>"Use armcommand/\ndisarmcommand",
- :variable=>@@var.ref('barmcmd'),
- :command=>proc{_barmcmd(@@var['barmcmd'],
+ chk2 = TkCheckbutton.new(subf, :text=>"Use armcommand/\ndisarmcommand",
+ :variable=>@@var.ref('barmcmd'),
+ :command=>proc{_barmcmd(@@var['barmcmd'],
but, arr1, arr2)})
Tk.pack(chk1, chk2, :anchor=>:w)
- label = TkLabel.new(parent, :textvariable=>@@var.ref('butcmd'),
+ label = TkLabel.new(parent, :textvariable=>@@var.ref('butcmd'),
:foreground=>'red').pack(:side=>:bottom, :pady=>4)
- labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Direction',
- :side=>:top, :anchor=>:w,
+ labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Direction',
+ :side=>:top, :anchor=>:w,
:relief=>:sunken, :borderwidth=>1)
subf = labf2.get_frame
@@var['bside'] = :top
[:top, :left, :bottom, :right].each{|dir|
- TkRadiobutton.new(subf, :text=>"#{dir} arrow",
- :variable=>@@var.ref('bside'), :value=>dir,
+ TkRadiobutton.new(subf, :text=>"#{dir} arrow",
+ :variable=>@@var.ref('bside'), :value=>dir,
:command=>proc{_bside(@@var['bside'], arr1, arr2)}
).pack(:anchor=>:w)
}
- labf3 = Tk::BWidget::LabelFrame.new(parent, :text=>'Relief',
- :side=>:top, :anchor=>:w,
+ labf3 = Tk::BWidget::LabelFrame.new(parent, :text=>'Relief',
+ :side=>:top, :anchor=>:w,
:relief=>:sunken, :borderwidth=>1)
subf = labf3.get_frame
@@var['brelief'] = :raised
[ %w(raised sunken ridge groove), %w(flat solid link)].each{|lrelief|
f = TkFrame.new(subf)
lrelief.each{|relief|
- TkRadiobutton.new(f, :text=>relief,
- :variable=>@@var.ref('brelief'), :value=>relief,
+ TkRadiobutton.new(f, :text=>relief,
+ :variable=>@@var.ref('brelief'), :value=>relief,
:command=>proc{
_brelief(@@var['brelief'], but, arr1, arr2)
}).pack(:anchor=>:w)
@@ -163,19 +163,19 @@ module DemoBasic
def self._barmcmd(value, but, arr1, arr2)
if TkComm.bool(value)
- but.configure(:armcommand=>proc{_butcmd('arm')},
- :disarmcommand=>proc{_butcmd('disarm')},
+ but.configure(:armcommand=>proc{_butcmd('arm')},
+ :disarmcommand=>proc{_butcmd('disarm')},
:command=>'')
[arr1, arr2].each{|arr|
- arr.configure(:armcommand=>proc{_butcmd('arm')},
- :disarmcommand=>proc{_butcmd('disarm')},
+ arr.configure(:armcommand=>proc{_butcmd('arm')},
+ :disarmcommand=>proc{_butcmd('disarm')},
:command=>'')
}
else
- but.configure(:armcommand=>'', :disarmcommand=>'',
+ but.configure(:armcommand=>'', :disarmcommand=>'',
:command=>proc{_butcmd('command')})
[arr1, arr2].each{|arr|
- arr.configure(:armcommand=>'', :disarmcommand=>'',
+ arr.configure(:armcommand=>'', :disarmcommand=>'',
:command=>proc{_butcmd('command')})
}
end