diff options
| author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-11 04:51:21 +0000 |
|---|---|---|
| committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-11 04:51:21 +0000 |
| commit | bbe91bcd1898d544739e41fdf91aa8288526540a (patch) | |
| tree | d280d8542cc44d1cd1a75e8ec87b1f9d231561b7 /ext/tk/sample/tkextlib/tktable/spreadsheet.rb | |
| parent | 28c7b64f14c02a953ba051acd144e4ee5144450e (diff) | |
| download | ruby-bbe91bcd1898d544739e41fdf91aa8288526540a.tar.gz ruby-bbe91bcd1898d544739e41fdf91aa8288526540a.tar.xz ruby-bbe91bcd1898d544739e41fdf91aa8288526540a.zip | |
* ext/tk/lib/tk/*: untabify
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/tkextlib/tktable/spreadsheet.rb')
| -rw-r--r-- | ext/tk/sample/tkextlib/tktable/spreadsheet.rb | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/ext/tk/sample/tkextlib/tktable/spreadsheet.rb b/ext/tk/sample/tkextlib/tktable/spreadsheet.rb index 5f3ba63bb..9da896f5a 100644 --- a/ext/tk/sample/tkextlib/tktable/spreadsheet.rb +++ b/ext/tk/sample/tkextlib/tktable/spreadsheet.rb @@ -31,11 +31,11 @@ def fill_table(tbl_list, page, r=10, c=10) (0...r).each{|i| (0...c).each{|j| if i!=0 && j!=0 - ary[i,j] = "#{page} #{i},#{j}" + ary[i,j] = "#{page} #{i},#{j}" elsif i!=0 - ary[i,j] = i.to_s + ary[i,j] = i.to_s else - ary[i,j] = (64+j).chr + ary[i,j] = (64+j).chr end } } @@ -68,16 +68,16 @@ 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, - :coltagcommand=>proc{|n| colorize(n)}, - :flashmode=>true, :selectmode=>:extended, - :colstretch=>:unset, :rowstretch=>:unset, - :browsecommand=>proc{|e| cur_var.value = e.new_index}) + :variable=>table_list[page.value], + :titlerows=>1, :titlecols=>1, + :coltagcommand=>proc{|n| colorize(n)}, + :flashmode=>true, :selectmode=>:extended, + :colstretch=>:unset, :rowstretch=>:unset, + :browsecommand=>proc{|e| cur_var.value = e.new_index}) page.trace(:w, proc{|var, elem, op| - changepage(table_list, table, entry, color, var, elem, op) - }) + changepage(table_list, table, entry, color, var, elem, op) + }) table.tag_configure('colored', :bg=>color[page.value]) table.tag_configure('title', :fg=>'red', :relief=>:groove) @@ -107,29 +107,29 @@ Tk.root.grid_rowconfig(2, :weight=>1) table.grid_configure(:sticky=>:news) entry.bind('Return', proc{ - r = table.row_index(:active) - c = table.col_index(:active) - rmax = table[:rows] - cmax = table[:cols] - - c += 1 - if c == cmax - c = table[:titlecols] - r += 1 - if r == rmax - r = table[:titlerows] - end - end - table.activate([r, c]) - table.see('active') - }) + r = table.row_index(:active) + c = table.col_index(:active) + rmax = table[:rows] + cmax = table[:cols] + + c += 1 + if c == cmax + c = table[:titlecols] + r += 1 + if r == rmax + r = table[:titlerows] + end + end + table.activate([r, c]) + table.see('active') + }) 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', - :command=>proc{ fill_table(table_list, page.value) }) + :command=>proc{ fill_table(table_list, page.value) }) m_file.add(:command, :label=>'Quit', :command=>proc{exit}) puts "Table is #{table.path} with array #{(table['variable'])}" |
