diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 15:13:14 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 15:13:14 +0000 |
commit | d0233291bc8a5068e52c69c210e5979e5324b5bc (patch) | |
tree | 7d9459449c33792c63eeb7baa071e76352e0baab /trunk/ext/tk/sample/tkextlib/tktable/debug.rb | |
parent | 0dc342de848a642ecce8db697b8fecd83a63e117 (diff) | |
parent | 72eaacaa15256ab95c3b52ea386f88586fb9da40 (diff) |
re-adding tag v1_9_0_4 as an alias of trunk@18848v1_9_0_4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_0_4@18849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'trunk/ext/tk/sample/tkextlib/tktable/debug.rb')
-rw-r--r-- | trunk/ext/tk/sample/tkextlib/tktable/debug.rb | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/trunk/ext/tk/sample/tkextlib/tktable/debug.rb b/trunk/ext/tk/sample/tkextlib/tktable/debug.rb deleted file mode 100644 index d5cd5e49ba..0000000000 --- a/trunk/ext/tk/sample/tkextlib/tktable/debug.rb +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env ruby -## -## debug.rb -## -## This demo uses most features of the table widget -## -## ( based on 'debug.tcl' included source archive of tktable extension ) -## -require 'tk' -require 'tkextlib/tktable' - -# create the table -ary = TkVariable.new_hash -rows = 25 -cols = 20 - -# fill table variable -((-(rows))..rows).each{|x| - ((-(cols))..cols).each{|y| - ary[x,y] = "r#{x},c#{y}" - } -} - -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, - :coltagcommand=>proc{|col| - col = Integer(col) - (col>0 && col%2 == 1)? 'OddCol': '' - }, - :selectmode=>:extended, :flashmode=>true, - :rowstretch=>:unset, :colstretch=>:unset, - :selecttitles=>false, :drawmode=>:single) - -sx = table.xscrollbar(TkScrollbar.new) -sy = table.yscrollbar(TkScrollbar.new) - -btn = TkButton.new(:text=>'Exit', :command=>proc{exit}) - -Tk.grid(lbl, '-', :sticky=>:ew) -Tk.grid(table, sy, :sticky=>:news) -Tk.grid(sx, :sticky=>:ew) -Tk.grid(btn, :sticky=>:ew, :columnspan=>2) - -Tk.root.grid_columnconfig(0, :weight=>1) -Tk.root.grid_rowconfig(1, :weight=>1) - -table.tag_configure('OddCol', :bg=>'brown', :fg=>'pink') -table.tag_configure('title', :bg=>'red', :fg=>'green', :relief=>:sunken) -table.tag_configure('dis', :state=>:disabled) - -first = table[:colorigin] -%w(n s e w nw ne sw se c).each_with_index{|anchor, idx| - table.tag_configure(anchor, :anchor=>anchor) - table.tag_row(anchor, idx) - table.set([idx,first], anchor) -} -courier = TkFont.new(:family=>'Courier', :size=>10) -table.tag_configure('s', :font=>courier, :justify=>:center) - -logo = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), 'tcllogo.gif')) -table.tag_configure('logo', :image=>logo, :showtext=>true) -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", - [2,2], "null\0byte") - -# This is in the row span -l = TkLabel.new(table, :text=>'Window s', :bg=>'yellow') -table.window_configure([6,0], :sticky=>:s, :window=>l) - -# This is in the row titles -l = TkLabel.new(table, :text=>'Window ne', :bg=>'yellow') -table.window_configure([4,-1], :sticky=>:ne, :window=>l) - -# This will get swallowed by a span -l = TkLabel.new(table, :text=>'Window ew', :bg=>'yellow') -table.window_configure([5,3], :sticky=>:ew, :window=>l) - -# This is in the col titles -l = TkLabel.new(table, :text=>'Window news', :bg=>'yellow') -table.window_configure([-5,1], :sticky=>:news, :window=>l) - -l = TkLabel.new(table.winfo_parent, :text=>'Sibling l', :bg=>'orange') -table.window_configure([5,1], :sticky=>:news, :window=>l) - -if table.span_list.empty? - table.set_spans([-1,-2], [0,3], [1,2], [0,5], [3,2], [2,2], [6,0], [4,0]) -end - -puts "Table is #{table.path} with array #{(table['variable'])}" - -# table.postscript(:file=>'out.ps', :first=>:origin, :last=>[2,2]) - -Tk.mainloop |