summaryrefslogtreecommitdiff
path: root/ext/tk/sample/tkextlib/bwidget
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/sample/tkextlib/bwidget')
-rw-r--r--ext/tk/sample/tkextlib/bwidget/basic.rb96
-rw-r--r--ext/tk/sample/tkextlib/bwidget/demo.rb84
-rw-r--r--ext/tk/sample/tkextlib/bwidget/dnd.rb16
-rw-r--r--ext/tk/sample/tkextlib/bwidget/manager.rb28
-rw-r--r--ext/tk/sample/tkextlib/bwidget/select.rb56
-rw-r--r--ext/tk/sample/tkextlib/bwidget/tmpldlg.rb162
-rw-r--r--ext/tk/sample/tkextlib/bwidget/tree.rb96
7 files changed, 269 insertions, 269 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
diff --git a/ext/tk/sample/tkextlib/bwidget/demo.rb b/ext/tk/sample/tkextlib/bwidget/demo.rb
index 785d2681a8..3eb98818f3 100644
--- a/ext/tk/sample/tkextlib/bwidget/demo.rb
+++ b/ext/tk/sample/tkextlib/bwidget/demo.rb
@@ -54,21 +54,21 @@ class BWidget_Demo
descmenu = [
'&File', 'all', 'file', 0, [
- ['command', 'E&xit', [], 'Exit BWidget demo', [],
+ ['command', 'E&xit', [], 'Exit BWidget demo', [],
{:command=>proc{exit}}]
- ],
+ ],
'&Options', 'all', 'options', 0, [
- ['checkbutton', 'Toolbar &1', ['all', 'option'],
- 'Show/hide toolbar 1', [],
- { :variable=>DemoVar.toolbar1,
+ ['checkbutton', 'Toolbar &1', ['all', 'option'],
+ 'Show/hide toolbar 1', [],
+ { :variable=>DemoVar.toolbar1,
:command=>proc{
DemoVar.mainframe.show_toolbar(0, DemoVar.toolbar1.value)
}
}
- ],
- ['checkbutton', 'Toolbar &2', ['all', 'option'],
- 'Show/hide toolbar 2', [],
- { :variable=>DemoVar.toolbar2,
+ ],
+ ['checkbutton', 'Toolbar &2', ['all', 'option'],
+ 'Show/hide toolbar 2', [],
+ { :variable=>DemoVar.toolbar2,
:command=>proc{
DemoVar.mainframe.show_toolbar(1, DemoVar.toolbar2.value)
}
@@ -81,8 +81,8 @@ class BWidget_Demo
DemoVar.prgindic.value = 0
DemoVar.mainframe = Tk::BWidget::MainFrame.new(
- :menu=>descmenu,
- :textvariable=>DemoVar.status,
+ :menu=>descmenu,
+ :textvariable=>DemoVar.status,
:progressvar=>DemoVar.prgindic
)
@@ -91,22 +91,22 @@ class BWidget_Demo
DemoVar.mainframe.add_toolbar{|tb1|
Tk::BWidget::ButtonBox.new(tb1, :spacing=>0, :padx=>1, :pady=>1){|bbox|
- add(:image=>Tk::BWidget::Bitmap.new('new'),
- :highlightthickness=>0, :takefocus=>0, :relief=>:link,
- :borderwidth=>1, :padx=>1, :pady=>1,
- :command=>proc{puts 'select "Create a new file" icon'},
+ add(:image=>Tk::BWidget::Bitmap.new('new'),
+ :highlightthickness=>0, :takefocus=>0, :relief=>:link,
+ :borderwidth=>1, :padx=>1, :pady=>1,
+ :command=>proc{puts 'select "Create a new file" icon'},
:helptext=>"Create a new file")
- add(:image=>Tk::BWidget::Bitmap.new('open'),
- :highlightthickness=>0, :takefocus=>0, :relief=>:link,
- :borderwidth=>1, :padx=>1, :pady=>1,
- :command=>proc{puts 'select "Open an existing file" icon'},
+ add(:image=>Tk::BWidget::Bitmap.new('open'),
+ :highlightthickness=>0, :takefocus=>0, :relief=>:link,
+ :borderwidth=>1, :padx=>1, :pady=>1,
+ :command=>proc{puts 'select "Open an existing file" icon'},
:helptext=>"Open an existing file")
- add(:image=>Tk::BWidget::Bitmap.new('save'),
- :highlightthickness=>0, :takefocus=>0, :relief=>:link,
- :borderwidth=>1, :padx=>1, :pady=>1,
- :command=>proc{puts 'select "Save file" icon'},
+ add(:image=>Tk::BWidget::Bitmap.new('save'),
+ :highlightthickness=>0, :takefocus=>0, :relief=>:link,
+ :borderwidth=>1, :padx=>1, :pady=>1,
+ :command=>proc{puts 'select "Save file" icon'},
:helptext=>"Save file")
pack(:side=>:left, :anchor=>:w)
@@ -119,22 +119,22 @@ class BWidget_Demo
DemoVar.prgindic.numeric += 1
Tk::BWidget::ButtonBox.new(tb1, :spacing=>0, :padx=>1, :pady=>1){|bbox|
- add(:image=>Tk::BWidget::Bitmap.new('cut'),
- :highlightthickness=>0, :takefocus=>0, :relief=>:link,
- :borderwidth=>1, :padx=>1, :pady=>1,
- :command=>proc{puts 'select "Cut selection" icon'},
+ add(:image=>Tk::BWidget::Bitmap.new('cut'),
+ :highlightthickness=>0, :takefocus=>0, :relief=>:link,
+ :borderwidth=>1, :padx=>1, :pady=>1,
+ :command=>proc{puts 'select "Cut selection" icon'},
:helptext=>"Cut selection")
- add(:image=>Tk::BWidget::Bitmap.new('copy'),
- :highlightthickness=>0, :takefocus=>0, :relief=>:link,
- :borderwidth=>1, :padx=>1, :pady=>1,
- :command=>proc{puts 'select "Copy selection" icon'},
+ add(:image=>Tk::BWidget::Bitmap.new('copy'),
+ :highlightthickness=>0, :takefocus=>0, :relief=>:link,
+ :borderwidth=>1, :padx=>1, :pady=>1,
+ :command=>proc{puts 'select "Copy selection" icon'},
:helptext=>"Copy selection")
- add(:image=>Tk::BWidget::Bitmap.new('paste'),
- :highlightthickness=>0, :takefocus=>0, :relief=>:link,
- :borderwidth=>1, :padx=>1, :pady=>1,
- :command=>proc{puts 'select "Paste selection" icon'},
+ add(:image=>Tk::BWidget::Bitmap.new('paste'),
+ :highlightthickness=>0, :takefocus=>0, :relief=>:link,
+ :borderwidth=>1, :padx=>1, :pady=>1,
+ :command=>proc{puts 'select "Paste selection" icon'},
:helptext=>"Paste selection")
pack(:side=>:left, :anchor=>:w)
@@ -145,7 +145,7 @@ class BWidget_Demo
DemoVar.prgindic.numeric += 1
tb2 = DemoVar.mainframe.add_toolbar
- DemoVar._wfont = Tk::BWidget::SelectFont::Toolbar.new(tb2,
+ DemoVar._wfont = Tk::BWidget::SelectFont::Toolbar.new(tb2,
:command=>proc{update_font(DemoVar._wfont[:font])}
)
DemoVar.font = DemoVar._wfont[:font]
@@ -213,18 +213,18 @@ class BWidget_Demo
top.withdraw
top.overrideredirect(true)
- ximg = TkLabel.new(top, :bitmap=>"@#{File.join(DEMODIR,'x1.xbm')}",
+ ximg = TkLabel.new(top, :bitmap=>"@#{File.join(DEMODIR,'x1.xbm')}",
:foreground=>'grey90', :background=>'white')
bwimg = TkLabel.new(ximg, :bitmap=>"@#{File.join(DEMODIR,'bwidget.xbm')}",
:foreground=>'grey90', :background=>'white')
frame = TkFrame.new(ximg, :background=>'white')
- TkLabel.new(frame, :text=>'Loading demo',
+ TkLabel.new(frame, :text=>'Loading demo',
:background=>'white', :font=>'times 8').pack
- TkLabel.new(frame, :textvariable=>DemoVar.prgtext,
+ TkLabel.new(frame, :textvariable=>DemoVar.prgtext,
:background=>'white', :font=>'times 8', :width=>35).pack
- Tk::BWidget::ProgressBar.new(frame, :width=>50, :height=>10,
- :background=>'white',
- :variable=>DemoVar.prgindic,
+ Tk::BWidget::ProgressBar.new(frame, :width=>50, :height=>10,
+ :background=>'white',
+ :variable=>DemoVar.prgindic,
:maximum=>10).pack
frame.place(:x=>0, :y=>0, :anchor=>:nw)
bwimg.place(:relx=>1, :rely=>1, :anchor=>:se)
diff --git a/ext/tk/sample/tkextlib/bwidget/dnd.rb b/ext/tk/sample/tkextlib/bwidget/dnd.rb
index 1c8b036530..b1b1cf60ff 100644
--- a/ext/tk/sample/tkextlib/bwidget/dnd.rb
+++ b/ext/tk/sample/tkextlib/bwidget/dnd.rb
@@ -12,19 +12,19 @@ module DemoDnD
titf1 = Tk::BWidget::TitleFrame.new(frame, :text=>'Drag source')
subf = titf1.get_frame
- ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry',
- :labelwidth=>14, :dragenabled=>true,
+ ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry',
+ :labelwidth=>14, :dragenabled=>true,
:dragevent=>3)
- labf1 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (text)',
+ labf1 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (text)',
:width=>14)
f = labf1.get_frame
- lab = Tk::BWidget::Label.new(f, :text=>'Drag this text',
+ lab = Tk::BWidget::Label.new(f, :text=>'Drag this text',
:dragenabled=>true, :dragevent=>3).pack
- labf2 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (bitmap)',
+ labf2 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label (bitmap)',
:width=>14)
f = labf2.get_frame
- lab = Tk::BWidget::Label.new(f, :bitmap=>'info',
+ lab = Tk::BWidget::Label.new(f, :bitmap=>'info',
:dragenabled=>true, :dragevent=>3).pack
Tk.pack(ent1, labf1, labf2, :side=>:top, :fill=>:x, :pady=>4)
@@ -32,11 +32,11 @@ module DemoDnD
titf2 = Tk::BWidget::TitleFrame.new(frame, :text=>'Drop targets')
subf = titf2.get_frame
- ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry',
+ ent1 = Tk::BWidget::LabelEntry.new(subf, :label=>'Entry',
:labelwidth=>14, :dropenabled=>true)
labf1 = Tk::BWidget::LabelFrame.new(subf, :text=>'Label', :width=>14)
f = labf1.get_frame
- lab = Tk::BWidget::Label.new(f, :dropenabled=>true,
+ lab = Tk::BWidget::Label.new(f, :dropenabled=>true,
:highlightthickness=>1).pack(:fill=>:x)
Tk.pack(ent1, labf1, :side=>:top, :fill=>:x, :pady=>4)
Tk.pack(titf1, titf2, :pady=>4)
diff --git a/ext/tk/sample/tkextlib/bwidget/manager.rb b/ext/tk/sample/tkextlib/bwidget/manager.rb
index 776cb3065b..a59afb8b86 100644
--- a/ext/tk/sample/tkextlib/bwidget/manager.rb
+++ b/ext/tk/sample/tkextlib/bwidget/manager.rb
@@ -32,19 +32,19 @@ module DemoManager
end
def self._mainframe(parent)
- labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Toolbar',
- :side=>:top, :anchor=>:w,
+ labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Toolbar',
+ :side=>:top, :anchor=>:w,
:relief=>:sunken, :borderwidth=>2)
subf = labf1.get_frame
- chk1 = TkCheckbutton.new(subf, :text=>'View toolbar 1',
- :variable=>DemoVar.toolbar1,
+ chk1 = TkCheckbutton.new(subf, :text=>'View toolbar 1',
+ :variable=>DemoVar.toolbar1,
:command=>proc{
DemoVar.mainframe.show_toolbar(
0, DemoVar.toolbar1.value
)
})
- chk2 = TkCheckbutton.new(subf, :text=>'View toolbar 2',
- :variable=>DemoVar.toolbar2,
+ chk2 = TkCheckbutton.new(subf, :text=>'View toolbar 2',
+ :variable=>DemoVar.toolbar2,
:command=>proc{
DemoVar.mainframe.show_toolbar(
1, DemoVar.toolbar2.value
@@ -54,12 +54,12 @@ module DemoManager
Tk.pack(chk1, chk2, :anchor=>:w, :fill=>:x)
labf1.pack(:fill=>:both)
- labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Status bar',
- :side=>:top, :anchor=>:w,
+ labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Status bar',
+ :side=>:top, :anchor=>:w,
:relief=>:sunken, :borderwidth=>2)
subf = labf2.get_frame
- chk1 = TkCheckbutton.new(subf, :text=>"Show Progress\nindicator",
- :justify=>:left, :variable=>@@progress,
+ chk1 = TkCheckbutton.new(subf, :text=>"Show Progress\nindicator",
+ :justify=>:left, :variable=>@@progress,
:command=>proc{ _show_progress })
chk1.pack(:anchor=>:w, :fill=>:x)
@@ -67,8 +67,8 @@ module DemoManager
end
def self._notebook(parent)
- TkCheckbutton.new(parent, :text=>'Homogeneous label',
- :variable=>@@homogeneous,
+ TkCheckbutton.new(parent, :text=>'Homogeneous label',
+ :variable=>@@homogeneous,
:command=>proc{
DemoVar.notebook[:homogeneous] = @@homogeneous.value
}).pack(:side=>:left, :anchor=>:n, :fill=>:x)
@@ -92,13 +92,13 @@ module DemoManager
sw.pack(:fill=>:both, :expand=>true)
}
- sw = Tk::BWidget::ScrolledWindow.new(pane3, :relief=>:sunken,
+ sw = Tk::BWidget::ScrolledWindow.new(pane3, :relief=>:sunken,
:borderwidth=>2)
sf = Tk::BWidget::ScrollableFrame.new(sw)
sw.set_widget(sf)
subf = sf.get_frame
lab = TkLabel.new(subf, :text=>'This is a ScrollableFrame')
- chk = TkCheckbutton.new(subf, :text=>'Constrained with',
+ chk = TkCheckbutton.new(subf, :text=>'Constrained with',
:variable=>@@constw, :command=>proc{
sf['constrainedwidth'] = @@constw.value
})
diff --git a/ext/tk/sample/tkextlib/bwidget/select.rb b/ext/tk/sample/tkextlib/bwidget/select.rb
index ea24b47e2e..3a1a810e14 100644
--- a/ext/tk/sample/tkextlib/bwidget/select.rb
+++ b/ext/tk/sample/tkextlib/bwidget/select.rb
@@ -13,28 +13,28 @@ module DemoSelect
titf1 = Tk::BWidget::TitleFrame.new(frame, :text=>'SpinBox')
subf = titf1.get_frame
- spin = Tk::BWidget::SpinBox.new(subf, :range=>[1, 100, 1],
- :textvariable=>@@var.ref('spin', 'var'),
+ spin = Tk::BWidget::SpinBox.new(subf, :range=>[1, 100, 1],
+ :textvariable=>@@var.ref('spin', 'var'),
:helptext=>'This is the SpinBox')
- ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var',
- :labelwidth=>10, :labelanchor=>:w,
- :textvariable=>@@var.ref('spin', 'var'),
- :editable=>0,
+ ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var',
+ :labelwidth=>10, :labelanchor=>:w,
+ :textvariable=>@@var.ref('spin', 'var'),
+ :editable=>0,
:helptext=>"This is an Entry reflecting\nthe linked var of SpinBox")
- labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options',
- :side=>:top, :anchor=>:w,
- :relief=>:sunken, :borderwidth=>1,
+ labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options',
+ :side=>:top, :anchor=>:w,
+ :relief=>:sunken, :borderwidth=>1,
:helptext=>'Modify some options of SpinBox')
subf = labf.get_frame
- chk1 = TkCheckbutton.new(subf, :text=>'Non editable',
- :variable=>@@var.ref('spin', 'editable'),
- :onvalue=>false, :offvalue=>true,
+ chk1 = TkCheckbutton.new(subf, :text=>'Non editable',
+ :variable=>@@var.ref('spin', 'editable'),
+ :onvalue=>false, :offvalue=>true,
:command=>proc{
spin.editable(@@var['spin', 'editable'])
})
- chk2 = TkCheckbutton.new(subf, :text=>'Disabled',
- :variable=>@@var.ref('spin', 'state'),
- :onvalue=>'disabled', :offvalue=>'normal',
+ chk2 = TkCheckbutton.new(subf, :text=>'Disabled',
+ :variable=>@@var.ref('spin', 'state'),
+ :onvalue=>'disabled', :offvalue=>'normal',
:command=>proc{
spin.state(@@var['spin', 'state'])
})
@@ -47,28 +47,28 @@ module DemoSelect
combo = Tk::BWidget::ComboBox.new(subf,
:textvariable=>@@var.ref('combo', 'var'),
:values=>[
- 'first value', 'second value',
- 'third value', 'fourth value',
+ 'first value', 'second value',
+ 'third value', 'fourth value',
'fifth value'
- ],
+ ],
:helptext=>'This is the ComboBox')
- ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var',
- :labelwidth=>10, :labelanchor=>:w,
+ ent = Tk::BWidget::LabelEntry.new(subf, :label=>'Linked var',
+ :labelwidth=>10, :labelanchor=>:w,
:textvariable=>@@var.ref('combo', 'var'),
:editable=>0, :helptext=>"This is an Entry reflecting\nthe linked var of ComboBox")
- labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options', :side=>:top,
- :anchor=>:w, :relief=>:sunken,
+ labf = Tk::BWidget::LabelFrame.new(subf, :text=>'Options', :side=>:top,
+ :anchor=>:w, :relief=>:sunken,
:borderwidth=>1, :helptext=>'Modify some options of ComboBox')
subf = labf.get_frame
- chk1 = TkCheckbutton.new(subf, :text=>'Non editable',
- :variable=>@@var.ref('combo', 'editable'),
- :onvalue=>false, :offvalue=>true,
+ chk1 = TkCheckbutton.new(subf, :text=>'Non editable',
+ :variable=>@@var.ref('combo', 'editable'),
+ :onvalue=>false, :offvalue=>true,
:command=>proc{
combo.editable(@@var['combo', 'editable'])
})
- chk2 = TkCheckbutton.new(subf, :text=>'Disabled',
- :variable=>@@var.ref('combo', 'state'),
- :onvalue=>'disabled', :offvalue=>'normal',
+ chk2 = TkCheckbutton.new(subf, :text=>'Disabled',
+ :variable=>@@var.ref('combo', 'state'),
+ :onvalue=>'disabled', :offvalue=>'normal',
:command=>proc{
combo.state(@@var['combo', 'state'])
})
diff --git a/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb b/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb
index 3d19c8d092..da2c9678c0 100644
--- a/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb
+++ b/ext/tk/sample/tkextlib/bwidget/tmpldlg.rb
@@ -23,14 +23,14 @@ module DemoDialog
titf4 = Tk::BWidget::TitleFrame.new(frame, :text=>'Other dialog')
subf = titf1.get_frame
- cmd = proc{ TkOption.read_file(File.join(Tk::BWidget::LIBRARY, 'lang',
+ cmd = proc{ TkOption.read_file(File.join(Tk::BWidget::LIBRARY, 'lang',
@@resources.value + '.rc')) }
- Tk.pack(TkRadiobutton.new(subf, :text=>'English', :value=>'en',
- :variable=>@@resources, :command=>cmd),
- TkRadiobutton.new(subf, :text=>'French', :value=>'fr',
- :variable=>@@resources, :command=>cmd),
- TkRadiobutton.new(subf, :text=>'German', :value=>'de',
- :variable=>@@resources, :command=>cmd),
+ Tk.pack(TkRadiobutton.new(subf, :text=>'English', :value=>'en',
+ :variable=>@@resources, :command=>cmd),
+ TkRadiobutton.new(subf, :text=>'French', :value=>'fr',
+ :variable=>@@resources, :command=>cmd),
+ TkRadiobutton.new(subf, :text=>'German', :value=>'de',
+ :variable=>@@resources, :command=>cmd),
:side=>:left)
_tmpldlg(titf2.get_frame)
@@ -46,34 +46,34 @@ module DemoDialog
@@tmpl['side'] = :bottom
@@tmpl['anchor'] = :c
- labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button side',
- :side=>:top, :anchor=>:w,
+ labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button side',
+ :side=>:top, :anchor=>:w,
:relief=>:sunken, :borderwidth=>1)
subf = labf1.get_frame
- Tk.pack(TkRadiobutton.new(subf, :text=>'Bottom', :value=>:bottom,
- :variable=>@@tmpl.ref('side'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'Left', :value=>:left,
- :variable=>@@tmpl.ref('side'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'Right', :value=>:right,
- :variable=>@@tmpl.ref('side'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'Top', :value=>:top,
- :variable=>@@tmpl.ref('side'), :anchor=>:w),
+ Tk.pack(TkRadiobutton.new(subf, :text=>'Bottom', :value=>:bottom,
+ :variable=>@@tmpl.ref('side'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'Left', :value=>:left,
+ :variable=>@@tmpl.ref('side'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'Right', :value=>:right,
+ :variable=>@@tmpl.ref('side'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'Top', :value=>:top,
+ :variable=>@@tmpl.ref('side'), :anchor=>:w),
:fill=>:x, :anchor=>:w)
- labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button anchor',
- :side=>:top, :anchor=>:w,
+ labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Button anchor',
+ :side=>:top, :anchor=>:w,
:relief=>:sunken, :borderwidth=>1)
subf = labf2.get_frame
- Tk.pack(TkRadiobutton.new(subf, :text=>'North', :value=>:n,
- :variable=>@@tmpl.ref('anchor'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'West', :value=>:w,
- :variable=>@@tmpl.ref('anchor'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'East', :value=>:e,
- :variable=>@@tmpl.ref('anchor'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'South', :value=>:s,
- :variable=>@@tmpl.ref('anchor'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'Center', :value=>:c,
- :variable=>@@tmpl.ref('anchor'), :anchor=>:w),
+ Tk.pack(TkRadiobutton.new(subf, :text=>'North', :value=>:n,
+ :variable=>@@tmpl.ref('anchor'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'West', :value=>:w,
+ :variable=>@@tmpl.ref('anchor'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'East', :value=>:e,
+ :variable=>@@tmpl.ref('anchor'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'South', :value=>:s,
+ :variable=>@@tmpl.ref('anchor'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'Center', :value=>:c,
+ :variable=>@@tmpl.ref('anchor'), :anchor=>:w),
:fill=>:x, :anchor=>:w)
sep = Tk::BWidget::Separator.new(parent, :orient=>:horizontal)
@@ -88,44 +88,44 @@ module DemoDialog
@@msg['type'] = 'ok'
@@msg['icon'] = 'info'
- labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Type', :side=>:top,
- :anchor=>:w, :relief=>:sunken,
+ labf1 = Tk::BWidget::LabelFrame.new(parent, :text=>'Type', :side=>:top,
+ :anchor=>:w, :relief=>:sunken,
:borderwidth=>1)
subf = labf1.get_frame
- Tk.pack(TkRadiobutton.new(subf, :text=>'Ok', :value=>'ok',
- :variable=>@@msg.ref('type'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'Ok, Cancel', :value=>'okcancel',
- :variable=>@@msg.ref('type'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'Retry, Cancel',
- :value=>'retrycancel',
- :variable=>@@msg.ref('type'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'Yes, No', :value=>'yesno',
- :variable=>@@msg.ref('type'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'Yes, No, Cancel',
- :value=>'yesnocancel',
- :variable=>@@msg.ref('type'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'Abort, Retry, Ignore',
- :value=>'abortretryignore',
- :variable=>@@msg.ref('type'), :anchor=>:w),
+ Tk.pack(TkRadiobutton.new(subf, :text=>'Ok', :value=>'ok',
+ :variable=>@@msg.ref('type'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'Ok, Cancel', :value=>'okcancel',
+ :variable=>@@msg.ref('type'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'Retry, Cancel',
+ :value=>'retrycancel',
+ :variable=>@@msg.ref('type'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'Yes, No', :value=>'yesno',
+ :variable=>@@msg.ref('type'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'Yes, No, Cancel',
+ :value=>'yesnocancel',
+ :variable=>@@msg.ref('type'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'Abort, Retry, Ignore',
+ :value=>'abortretryignore',
+ :variable=>@@msg.ref('type'), :anchor=>:w),
:fill=>:x, :anchor=>:w)
- Tk.pack(TkRadiobutton.new(subf, :text=>'User', :value=>'user',
- :variable=>@@msg.ref('type'), :anchor=>:w),
+ Tk.pack(TkRadiobutton.new(subf, :text=>'User', :value=>'user',
+ :variable=>@@msg.ref('type'), :anchor=>:w),
Tk::BWidget::Entry.new(subf, :textvariable=>@@msg.ref('buttons')),
:side=>:left)
- labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Icon', :side=>:top,
- :anchor=>:w, :relief=>:sunken,
+ labf2 = Tk::BWidget::LabelFrame.new(parent, :text=>'Icon', :side=>:top,
+ :anchor=>:w, :relief=>:sunken,
:borderwidth=>1)
subf = labf2.get_frame
- Tk.pack(TkRadiobutton.new(subf, :text=>'Information', :value=>'info',
- :variable=>@@msg.ref('icon'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'Question', :value=>'question',
- :variable=>@@msg.ref('icon'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'Warning', :value=>'warning',
- :variable=>@@msg.ref('icon'), :anchor=>:w),
- TkRadiobutton.new(subf, :text=>'Error', :value=>'error',
- :variable=>@@msg.ref('icon'), :anchor=>:w),
+ Tk.pack(TkRadiobutton.new(subf, :text=>'Information', :value=>'info',
+ :variable=>@@msg.ref('icon'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'Question', :value=>'question',
+ :variable=>@@msg.ref('icon'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'Warning', :value=>'warning',
+ :variable=>@@msg.ref('icon'), :anchor=>:w),
+ TkRadiobutton.new(subf, :text=>'Error', :value=>'error',
+ :variable=>@@msg.ref('icon'), :anchor=>:w),
:fill=>:x, :anchor=>:w)
sep = Tk::BWidget::Separator.new(parent, :orient=>:horizontal)
@@ -139,13 +139,13 @@ module DemoDialog
def self._stddlg(parent)
Tk.pack(TkButton.new(parent, :text=>'Select a color '){|w|
command(proc{DemoDialog._show_color(w)})
- },
- TkButton.new(parent, :text=>'Font selector dialog',
- :command=>proc{_show_fontdlg}),
- TkButton.new(parent, :text=>'Progression dialog',
- :command=>proc{_show_progdlg}),
- TkButton.new(parent, :text=>'Password dialog',
- :command=>proc{_show_passdlg}),
+ },
+ TkButton.new(parent, :text=>'Font selector dialog',
+ :command=>proc{_show_fontdlg}),
+ TkButton.new(parent, :text=>'Progression dialog',
+ :command=>proc{_show_progdlg}),
+ TkButton.new(parent, :text=>'Password dialog',
+ :command=>proc{_show_passdlg}),
:side=>:left, :padx=>5, :anchor=>:w)
end
@@ -158,15 +158,15 @@ module DemoDialog
end
def self._show_tmpldlg
- dlg = Tk::BWidget::Dialog.new(:relative=>Tk.root, :modal=>:local,
- :separator=>true, :title=>'Template dialog',
- :side=>@@tmpl['side'],
- :anchor=>@@tmpl['anchor'],
+ dlg = Tk::BWidget::Dialog.new(:relative=>Tk.root, :modal=>:local,
+ :separator=>true, :title=>'Template dialog',
+ :side=>@@tmpl['side'],
+ :anchor=>@@tmpl['anchor'],
:default=>0, :cancel=>1)
dlg.add('name'=>'ok')
dlg.add('name'=>'cancel')
- TkMessage.new(dlg.get_frame, :text=>"Template\nDialog", :justify=>:center,
- :anchor=>:c, :width=>80).pack(:fill=>:both, :expand=>true,
+ TkMessage.new(dlg.get_frame, :text=>"Template\nDialog", :justify=>:center,
+ :anchor=>:c, :width=>80).pack(:fill=>:both, :expand=>true,
:padx=>100, :pady=>100)
dlg.draw
dlg.destroy
@@ -174,16 +174,16 @@ module DemoDialog
def self._show_msgdlg
@@msgdlg.destroy if @@msgdlg
- @@msgdlg = Tk::BWidget::MessageDlg.new(:relative=>Tk.root,
- :message=>'Message for MessageBox',
- :type=>@@msg['type'],
- :icon=>@@msg['icon'],
+ @@msgdlg = Tk::BWidget::MessageDlg.new(:relative=>Tk.root,
+ :message=>'Message for MessageBox',
+ :type=>@@msg['type'],
+ :icon=>@@msg['icon'],
:buttons=>@@msg['buttons'])
@@msgdlg.create
end
def self._show_fontdlg
- font = Tk::BWidget::SelectFont.new(:relative=>Tk.root,
+ font = Tk::BWidget::SelectFont.new(:relative=>Tk.root,
:font=>DemoVar.font).create
DemoVar::Demo.update_font(font)
end
@@ -192,11 +192,11 @@ module DemoDialog
@@progmsg.value = "Compute in progress..."
@@progval.value = 0
- @@progdlg = Tk::BWidget::ProgressDlg.new(:relative=>Tk.root,
- :title=>'Wait...',
- :type=>'infinite', :width=>20,
- :textvariable=>@@progmsg,
- :variable=>@@progval,
+ @@progdlg = Tk::BWidget::ProgressDlg.new(:relative=>Tk.root,
+ :title=>'Wait...',
+ :type=>'infinite', :width=>20,
+ :textvariable=>@@progmsg,
+ :variable=>@@progval,
:stop=>'Stop') {
command(proc{self.destroy})
create
diff --git a/ext/tk/sample/tkextlib/bwidget/tree.rb b/ext/tk/sample/tkextlib/bwidget/tree.rb
index e1fcaa774f..9ef6569d16 100644
--- a/ext/tk/sample/tkextlib/bwidget/tree.rb
+++ b/ext/tk/sample/tkextlib/bwidget/tree.rb
@@ -16,28 +16,28 @@ module DemoTree
pane = pw.add(:weight=>1)
title = Tk::BWidget::TitleFrame.new(pane, :text=>'Directory tree')
- sw = Tk::BWidget::ScrolledWindow.new(title.get_frame,
+ sw = Tk::BWidget::ScrolledWindow.new(title.get_frame,
:relief=>:sunken, :borderwidth=>2)
- tree = Tk::BWidget::Tree.new(sw, :relief=>:flat, :borderwidth=>0,
- :width=>15, :highlightthickness=>0,
- :redraw=>false, :dropenabled=>true,
- :dragenabled=>true, :dragevent=>3,
+ tree = Tk::BWidget::Tree.new(sw, :relief=>:flat, :borderwidth=>0,
+ :width=>15, :highlightthickness=>0,
+ :redraw=>false, :dropenabled=>true,
+ :dragenabled=>true, :dragevent=>3,
:droptypes=>[
'TREE_NODE', [
- :copy, [],
+ :copy, [],
:move, [],
:link, []
- ],
+ ],
'LISTBOX_ITEM', [
- :copy, [],
+ :copy, [],
:move, [],
:link, []
]
- ],
- :opencmd=>proc{|node|
+ ],
+ :opencmd=>proc{|node|
moddir(1, tree, node)
- },
- :closecmd=>proc{|node|
+ },
+ :closecmd=>proc{|node|
moddir(0, tree, node)
})
sw.set_widget(tree)
@@ -47,24 +47,24 @@ module DemoTree
pane = pw.add(:weight=>2)
lf = Tk::BWidget::TitleFrame.new(pane, :text=>'Content')
- sw = Tk::BWidget::ScrolledWindow.new(lf.get_frame,
- :scrollbar=>:horizontal,
- :auto=>:none, :relief=>:sunken,
+ sw = Tk::BWidget::ScrolledWindow.new(lf.get_frame,
+ :scrollbar=>:horizontal,
+ :auto=>:none, :relief=>:sunken,
:borderwidth=>2)
- list = Tk::BWidget::ListBox.new(sw, :relief=>:flat, :borderwidth=>0,
- :highlightthickness=>0, :width=>20,
- :multicolumn=>true, :redraw=>false,
- :dragevent=>3, :dropenabled=>true,
- :dragenabled=>true,
+ list = Tk::BWidget::ListBox.new(sw, :relief=>:flat, :borderwidth=>0,
+ :highlightthickness=>0, :width=>20,
+ :multicolumn=>true, :redraw=>false,
+ :dragevent=>3, :dropenabled=>true,
+ :dragenabled=>true,
:droptypes=>[
'TREE_NODE', [
- :copy, [],
+ :copy, [],
:move, [],
:link, []
- ],
+ ],
'LISTBOX_ITEM', [
- :copy, [],
+ :copy, [],
:move, [],
:link, []
]
@@ -77,43 +77,43 @@ module DemoTree
tree.textbind('ButtonPress-1',
proc{|node, ev| select('tree', 1, tree, list, node)})
- tree.textbind('Double-ButtonPress-1',
+ tree.textbind('Double-ButtonPress-1',
proc{|node, ev| select('tree', 2, tree, list, node)})
list.textbind('ButtonPress-1',
proc{|node, ev| select('list', 1, tree, list, node)})
- list.textbind('Double-ButtonPress-1',
+ list.textbind('Double-ButtonPress-1',
proc{|node, ev| select('list', 2, tree, list, node)})
- list.imagebind('Double-ButtonPress-1',
+ list.imagebind('Double-ButtonPress-1',
proc{|node, ev| select('list', 2, tree, list, node)})
- nb.itemconfigure('demoTree',
- :createcmd=>proc{|*args| init(tree, list, *args)},
+ nb.itemconfigure('demoTree',
+ :createcmd=>proc{|*args| init(tree, list, *args)},
:raisecmd=>proc{
- Tk.root.geometry =~
+ Tk.root.geometry =~
/\d+x\d+([+-]{1,2}\d+)([+-]{1,2}\d+)/
global_w = ($1 || 0).to_i
global_h = ($2 || 0).to_i
if @@top
- Tk::BWidget.place(@@top, 0, 0, :at,
+ Tk::BWidget.place(@@top, 0, 0, :at,
global_w - Tk.root.winfo_screenwidth, global_h)
@@top.deiconify
Tk.root.bind('Unmap', proc{@@top.withdraw})
Tk.root.bind('Map', proc{@@top.deiconify})
Tk.root.bind('Configure', proc{|w|
if w == Tk.root
- Tk.root.geometry =~
+ Tk.root.geometry =~
/\d+x\d+([+-]{1,2}\d+)([+-]{1,2}\d+)/
global_w = ($1 || 0).to_i
global_h = ($2 || 0).to_i
- Tk::BWidget.place(@@top, 0, 0, :at,
- global_w - Tk.root.winfo_screenwidth,
+ Tk::BWidget.place(@@top, 0, 0, :at,
+ global_w - Tk.root.winfo_screenwidth,
global_h)
end
}, '%W')
end
- },
+ },
:leavecmd=>proc{
@@top.withdraw if @@top
Tk.root.bind_remove('Unmap')
@@ -131,8 +131,8 @@ module DemoTree
rootdir = 'c:'
end
- tree.insert('end', 'root', 'home',
- :text=>rootdir, :data=>rootdir, :open=>true,
+ tree.insert('end', 'root', 'home',
+ :text=>rootdir, :data=>rootdir, :open=>true,
:image=>Tk::BWidget::Bitmap.new('openfold'))
getdir(tree, 'home', rootdir)
select('tree', 1, tree, list, 'home')
@@ -147,8 +147,8 @@ module DemoTree
@@top.resizable(false, false)
@@top.title('Drag rectangle to scroll directory tree')
@@top.transient(Tk.root)
- Tk::BWidget::ScrollView.new(@@top, :window=>tree, :fill=>'white',
- :width=>300, :height=>300, :relief=>:sunken,
+ Tk::BWidget::ScrollView.new(@@top, :window=>tree, :fill=>'white',
+ :width=>300, :height=>300, :relief=>:sunken,
:bd=>1).pack(:fill=>:both, :expand=>true)
end
@@ -156,11 +156,11 @@ module DemoTree
lentries = Dir.glob(File.join(path, '*')).sort
lfiles = []
lentries.each{|f|
- basename = File.basename(f)
+ basename = File.basename(f)
if File.directory?(f)
- Tk::BWidget::Tree::Node.new(tree, node,
- :index=>'end', :text=>basename,
- :image=>Tk::BWidget::Bitmap.new('folder'),
+ Tk::BWidget::Tree::Node.new(tree, node,
+ :index=>'end', :text=>basename,
+ :image=>Tk::BWidget::Bitmap.new('folder'),
:drawcross=>:allways, :data=>f)
@@count += 1
else
@@ -187,7 +187,7 @@ module DemoTree
def self.select(where, num, tree, list, node)
@@dblclick = true
if num == 1
- if (where == 'tree' &&
+ if (where == 'tree' &&
tree.selection_get.find{|x|
TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node)
})
@@ -195,7 +195,7 @@ module DemoTree
Tk.after(500, proc{edit('tree', tree, list, node)})
return
end
- if (where == 'list' &&
+ if (where == 'list' &&
list.selection_get.find{|x|
TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node)
})
@@ -230,13 +230,13 @@ module DemoTree
end
tree.nodes(node).each{|subnode|
- list.insert('end', subnode,
- :text=>tree.itemcget(subnode, :text),
+ list.insert('end', subnode,
+ :text=>tree.itemcget(subnode, :text),
:image=>Tk::BWidget::Bitmap.new('folder'))
}
TkComm.simplelist(dir).each{|f|
- Tk::BWidget::ListBox::Item.new(list, 'end', :text=>f,
+ Tk::BWidget::ListBox::Item.new(list, 'end', :text=>f,
:image=>Tk::BWidget::Bitmap.new('file'))
}
end
@@ -244,7 +244,7 @@ module DemoTree
def self.edit(where, tree, list, node)
return if @@dblclick
- if (where == 'tree' &&
+ if (where == 'tree' &&
tree.selection_get.find{|x|
TkUtil._get_eval_string(x) == TkUtil._get_eval_string(node)
})