diff options
Diffstat (limited to 'ext/tk/sample/tkextlib/tktable')
-rw-r--r-- | ext/tk/sample/tkextlib/tktable/basic.rb | 14 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/tktable/buttons.rb | 12 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/tktable/command.rb | 22 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/tktable/debug.rb | 16 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/tktable/dynarows.rb | 14 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/tktable/maxsize.rb | 14 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/tktable/spreadsheet.rb | 16 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/tktable/valid.rb | 12 |
8 files changed, 60 insertions, 60 deletions
diff --git a/ext/tk/sample/tkextlib/tktable/basic.rb b/ext/tk/sample/tkextlib/tktable/basic.rb index 0d2d48893a..dddbb776dc 100644 --- a/ext/tk/sample/tkextlib/tktable/basic.rb +++ b/ext/tk/sample/tkextlib/tktable/basic.rb @@ -3,7 +3,7 @@ ## basic.rb ## ## This demo shows the basic use of the table widget -## +## ## ( based on 'basic.tcl' included source archive of tktable extension ) ## require 'tk' @@ -22,19 +22,19 @@ cols = 8 lbl = TkLabel.new(:text=>"TkTable v1 Example") -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, - :width=>6, :height=>6, - :titlerows=>1, :titlecols=>2, - :roworigin=>-1, :colorigin=>-2, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, + :width=>6, :height=>6, + :titlerows=>1, :titlecols=>2, + :roworigin=>-1, :colorigin=>-2, :rowstretchmode=>:last, :colstretchmode=>:last, :rowtagcommand=>proc{|row| row = Integer(row) (row>0 && row%2 == 1)? 'OddRow': '' - }, + }, :coltagcommand=>proc{|col| col = Integer(col) (col>0 && col%2 == 1)? 'OddCol': '' - }, + }, :selectmode=>:extended, :sparsearray=>false) sx = table.xscrollbar(TkScrollbar.new) diff --git a/ext/tk/sample/tkextlib/tktable/buttons.rb b/ext/tk/sample/tkextlib/tktable/buttons.rb index b21e8673c2..e35c137a28 100644 --- a/ext/tk/sample/tkextlib/tktable/buttons.rb +++ b/ext/tk/sample/tkextlib/tktable/buttons.rb @@ -14,11 +14,11 @@ tab = TkVariable.new_hash rows = 20 cols = 20 -table = Tk::TkTable.new(:rows=>rows + 1, :cols=>cols + 1, - :variable=>tab, :titlerows=>1, :titlecols=>1, - :roworigin=>-1, :colorigin=>-1, - :colwidth=>4, :width=>8, :height=>8, - :cursor=>'top_left_arrow', :borderwidth=>2, +table = Tk::TkTable.new(:rows=>rows + 1, :cols=>cols + 1, + :variable=>tab, :titlerows=>1, :titlecols=>1, + :roworigin=>-1, :colorigin=>-1, + :colwidth=>4, :width=>8, :height=>8, + :cursor=>'top_left_arrow', :borderwidth=>2, :flashmode=>false, :state=>:disabled) sx = table.xscrollbar(TkScrollbar.new) @@ -67,7 +67,7 @@ table.bind('1', proc{|w, x, y| 0.step(cols){|j| if i == 0 tab[-1,j] = j - end + end tab[i,j] = "OFF" table.tag_cell('OFF', "#{i},#{j}") } diff --git a/ext/tk/sample/tkextlib/tktable/command.rb b/ext/tk/sample/tkextlib/tktable/command.rb index bf36159ccc..e697ccf3bf 100644 --- a/ext/tk/sample/tkextlib/tktable/command.rb +++ b/ext/tk/sample/tkextlib/tktable/command.rb @@ -27,7 +27,7 @@ current = TkLabel.new(:textvariable=>cur_var, :width=>5) ent_var = TkVariable.new entry = TkEntry.new(:textvariable=>ent_var) -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :command=>[proc{|mode, cell, val| if (mode == :w) data[cell] = val @@ -38,10 +38,10 @@ table = Tk::TkTable.new(:rows=>rows, :cols=>cols, '' # not exist end end - }, '%i %C %s'], - :width=>6, :height=>6, - :titlerows=>1, :titlecols=>1, - :roworigin=>-1, :colorigin=>-1, + }, '%i %C %s'], + :width=>6, :height=>6, + :titlerows=>1, :titlecols=>1, + :roworigin=>-1, :colorigin=>-1, :rowstretchmode=>:last, :colstretchmode=>:last, :rowtagcommand=>proc{|row| row = Integer(row) @@ -50,20 +50,20 @@ table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :coltagcommand=>proc{|col| col = Integer(col) (col>0 && col%2 == 1)? 'OddCol': '' - }, - :selectmode=>:extended, :flashmode=>true, + }, + :selectmode=>:extended, :flashmode=>true, :rowstretch=>:unset, :colstretch=>:unset, :browsecommand=>[proc{|w, s| cur_var.value = s ent_var.value = w.get(s) - }, '%W %S'], - :validate=>true, - :validatecommand=>proc{|e| + }, '%W %S'], + :validate=>true, + :validatecommand=>proc{|e| ent_var.value = e.new_value; true }) =begin :validatecommand=>[ - proc{|s| + proc{|s| ent_var.value = s; true }, '%S']) =end diff --git a/ext/tk/sample/tkextlib/tktable/debug.rb b/ext/tk/sample/tkextlib/tktable/debug.rb index d5cd5e49ba..016d5b353e 100644 --- a/ext/tk/sample/tkextlib/tktable/debug.rb +++ b/ext/tk/sample/tkextlib/tktable/debug.rb @@ -23,15 +23,15 @@ cols = 20 lbl = TkLabel.new(:text=>"TkTable v2 Example") -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, - :width=>6, :height=>6, - :titlerows=>1, :titlecols=>2, - :roworigin=>-5, :colorigin=>-2, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, + :width=>6, :height=>6, + :titlerows=>1, :titlecols=>2, + :roworigin=>-5, :colorigin=>-2, :coltagcommand=>proc{|col| col = Integer(col) (col>0 && col%2 == 1)? 'OddCol': '' - }, - :selectmode=>:extended, :flashmode=>true, + }, + :selectmode=>:extended, :flashmode=>true, :rowstretch=>:unset, :colstretch=>:unset, :selecttitles=>false, :drawmode=>:single) @@ -67,8 +67,8 @@ table.tag_cell('logo', [1,2], [2,3], [4,1]) table.tag_cell('dis', [2,1], [1,-1], [3,0]) table.set_width([-2,8], [-1,9], [0, 12], [4, 14]) -table.set([1,1], "multi-line\ntext\nmight be\ninteresting", - [3,2], "more\nmulti-line\nplaying\n", +table.set([1,1], "multi-line\ntext\nmight be\ninteresting", + [3,2], "more\nmulti-line\nplaying\n", [2,2], "null\0byte") # This is in the row span diff --git a/ext/tk/sample/tkextlib/tktable/dynarows.rb b/ext/tk/sample/tkextlib/tktable/dynarows.rb index d083e26559..cc72a021cf 100644 --- a/ext/tk/sample/tkextlib/tktable/dynarows.rb +++ b/ext/tk/sample/tkextlib/tktable/dynarows.rb @@ -5,7 +5,7 @@ ## This demos shows the use of the validation mechanism of the table ## and uses the table's cache (no -command or -variable) with a cute ## dynamic row routine. -## +## ## ( based on 'dynarows.tcl' included source archive of tktable extension ) ## require 'tk' @@ -24,7 +24,7 @@ def table_validate(w, idx) begin time = Tk.tk_call('clock', 'scan', val) date = [] - Tk.tk_call('clock', 'format', time, + Tk.tk_call('clock', 'format', time, :format=>'%m %d %Y').split(' ').each{|item| date << item.sub(/^\s*0*/,'') } @@ -54,12 +54,12 @@ end lbl = TkLabel.new(:text=>"Dynamic Date Validated Rows") -table = Tk::TkTable.new(:rows=>2, :cols=>3, :cache=>1, :selecttype=>:row, - :titlerows=>1, :titlecols=>1, :height=>5, - :colstretch=>:unset, :rowstretch=>:unset, - :autoclear=>true, +table = Tk::TkTable.new(:rows=>2, :cols=>3, :cache=>1, :selecttype=>:row, + :titlerows=>1, :titlecols=>1, :height=>5, + :colstretch=>:unset, :rowstretch=>:unset, + :autoclear=>true, :browsecommand=>[ - proc{|w,s| table_validate(w, s)}, + proc{|w,s| table_validate(w, s)}, '%W %s' ]) table.set([0,1], 'Begin', [0,2], 'End', [1,0], '*') diff --git a/ext/tk/sample/tkextlib/tktable/maxsize.rb b/ext/tk/sample/tkextlib/tktable/maxsize.rb index aff68ff377..74e136c49c 100644 --- a/ext/tk/sample/tkextlib/tktable/maxsize.rb +++ b/ext/tk/sample/tkextlib/tktable/maxsize.rb @@ -4,7 +4,7 @@ ## ## This demo uses a really big table. The big startup time is in ## filling the table's Tcl array var. -## +## ## ( based on 'maxsize.tcl' included source archive of tktable extension ) ## require 'tk' @@ -23,15 +23,15 @@ cols = 10 lbl = TkLabel.new(:text=>"TkTable v2 Example") -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, - :width=>6, :height=>8, - :titlerows=>1, :titlecols=>1, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :variable=>ary, + :width=>6, :height=>8, + :titlerows=>1, :titlecols=>1, :coltagcommand=>proc{|col| col = Integer(col) (col>0 && col%2 == 1)? 'OddCol': '' - }, - :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, + }, + :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, :selecttitles=>false, :drawmode=>:slow) sx = table.xscrollbar(TkScrollbar.new) diff --git a/ext/tk/sample/tkextlib/tktable/spreadsheet.rb b/ext/tk/sample/tkextlib/tktable/spreadsheet.rb index 9da896f5a7..2953b2e597 100644 --- a/ext/tk/sample/tkextlib/tktable/spreadsheet.rb +++ b/ext/tk/sample/tkextlib/tktable/spreadsheet.rb @@ -4,7 +4,7 @@ ## ## This demos shows how you can simulate a 3D table ## and has other basic features to begin a basic spreadsheet -## +## ## ( based on 'spreadsheet.tcl' included source archive of tktable extension ) ## require 'tk' @@ -67,15 +67,15 @@ optmenu = TkOptionMenubutton.new(page, *(%w(AA BB CC DD))) fill_table(table_list, page.value) fill_table(table_list, 'BB', Integer(rows/2), Integer(cols/2)) -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :width=>5, :height=>5, - :variable=>table_list[page.value], - :titlerows=>1, :titlecols=>1, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :width=>5, :height=>5, + :variable=>table_list[page.value], + :titlerows=>1, :titlecols=>1, :coltagcommand=>proc{|n| colorize(n)}, - :flashmode=>true, :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, + :flashmode=>true, :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, :browsecommand=>proc{|e| cur_var.value = e.new_index}) -page.trace(:w, proc{|var, elem, op| +page.trace(:w, proc{|var, elem, op| changepage(table_list, table, entry, color, var, elem, op) }) @@ -128,7 +128,7 @@ menu = TkMenu.new m_file = TkMenu.new(menu) Tk.root.menu(menu) menu.add(:cascade, :label=>'File', :underline=>0, :menu=>m_file) -m_file.add(:command, :label=>'Fill Array', +m_file.add(:command, :label=>'Fill Array', :command=>proc{ fill_table(table_list, page.value) }) m_file.add(:command, :label=>'Quit', :command=>proc{exit}) diff --git a/ext/tk/sample/tkextlib/tktable/valid.rb b/ext/tk/sample/tkextlib/tktable/valid.rb index e5d3f11d84..98e9c3855a 100644 --- a/ext/tk/sample/tkextlib/tktable/valid.rb +++ b/ext/tk/sample/tkextlib/tktable/valid.rb @@ -4,7 +4,7 @@ ## ## This demos shows the use of the validation mechanism of the table ## and uses the table's cache (no -command or -variable) -## +## ## ( based on 'valid.tcl' included source archive of tktable extension ) ## require 'tk' @@ -53,12 +53,12 @@ end lbl = TkLabel.new(:text=>"TkTable v1 Validated Table Example") -table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :cache=>1, - :width=>5, :height=>5, :titlerows=>1, :titlecols=>1, +table = Tk::TkTable.new(:rows=>rows, :cols=>cols, :cache=>1, + :width=>5, :height=>5, :titlerows=>1, :titlecols=>1, :coltagcommand=>proc{|n| colorize(n)}, - :flashmode=>true, :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, - :validate=>true, + :flashmode=>true, :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, + :validate=>true, :validatecommand=>proc{|e| unless e.widget.tag_include?('title', e.index) validate_proc(e.column, e.new_value) |