diff options
| author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-01 16:09:54 +0000 |
|---|---|---|
| committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-01 16:09:54 +0000 |
| commit | 72e35a71aa4b38d661ee20895fc1e39a1ec6905c (patch) | |
| tree | dfeb96c4772df8caba4e01e749c8f3e1262f8fe0 /ext/tk/sample/propagate.rb | |
| parent | 2045cc0e0b4391ed856ce8bcb885e80668e07842 (diff) | |
| download | ruby-72e35a71aa4b38d661ee20895fc1e39a1ec6905c.tar.gz ruby-72e35a71aa4b38d661ee20895fc1e39a1ec6905c.tar.xz ruby-72e35a71aa4b38d661ee20895fc1e39a1ec6905c.zip | |
* renewal Ruby/Tk
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/propagate.rb')
| -rw-r--r-- | ext/tk/sample/propagate.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ext/tk/sample/propagate.rb b/ext/tk/sample/propagate.rb new file mode 100644 index 000000000..a6fbc9725 --- /dev/null +++ b/ext/tk/sample/propagate.rb @@ -0,0 +1,30 @@ +#!/usr/bin/env ruby +require 'tk' + +TkLabel.new(:text=>"Please click the bottom frame").pack + +f = TkFrame.new(:width=>400, :height=>100, :background=>'yellow', + :relief=>'ridge', :borderwidth=>5).pack + +# TkPack.propagate(f, false) # <== important!! +f.pack_propagate(false) # <== important!! + +list = (1..3).collect{|n| + TkButton.new(f, :text=>"button#{'-X'*n}"){ + command proc{ + puts "button#{'-X'*n}" + self.unpack + } + } +} + +list.unshift(nil) + +f.bind('1', proc{ + w = list.shift + w.unpack if w + list.push(w) + list[0].pack(:expand=>true, :anchor=>:center) if list[0] + }) + +Tk.mainloop |
