diff options
author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-31 14:55:37 +0000 |
---|---|---|
committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-03-31 14:55:37 +0000 |
commit | 443cc6916141927c180ea39a7f7258c5675a0996 (patch) | |
tree | 5e58a4b207192a4eeece4736cddde29980d062ce /ext | |
parent | 2d422c1918d778a0bd2531a18656ceda983081c2 (diff) | |
download | ruby-443cc6916141927c180ea39a7f7258c5675a0996.tar.gz ruby-443cc6916141927c180ea39a7f7258c5675a0996.tar.xz ruby-443cc6916141927c180ea39a7f7258c5675a0996.zip |
* ext/tk/sample/tkextlib/treectrl/demo.rb: should use Hash#index.
* ext/tk/sample/tkextlib/treectrl/demo.rb: TkImage was not cached properly.
* ext/tk/sample/tkextlib/treectrl/random.rb: fixed typo.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@8233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/tk/sample/tkextlib/treectrl/demo.rb | 7 | ||||
-rw-r--r-- | ext/tk/sample/tkextlib/treectrl/random.rb | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/ext/tk/sample/tkextlib/treectrl/demo.rb b/ext/tk/sample/tkextlib/treectrl/demo.rb index acb5fcc19..892b5a62c 100644 --- a/ext/tk/sample/tkextlib/treectrl/demo.rb +++ b/ext/tk/sample/tkextlib/treectrl/demo.rb @@ -7,6 +7,10 @@ $ScriptDir = File.dirname(File.expand_path(__FILE__)) $HasColumnCreate = Tk::TreeCtrl::HasColumnCreateCommand +class Hash + alias key index +end + class TkTreeCtrl_demo def initialize(dir) @ScriptDir = dir || '.' @@ -102,9 +106,8 @@ class TkTreeCtrl_demo def init_pics(*args) args.each{|pat| - pat = "#{pat}.gif" unless TkImage.names.find{|img| (name = @images.key(img)) && File.fnmatch(pat, name)} - Dir.glob(File.join(@ScriptDir, 'pics', pat)).each{|file| + Dir.glob(File.join(@ScriptDir, 'pics', "#{pat}.gif")).each{|file| name = File.basename(file, '.gif') img = TkPhotoImage.new(:file=>file) @images[name] = img diff --git a/ext/tk/sample/tkextlib/treectrl/random.rb b/ext/tk/sample/tkextlib/treectrl/random.rb index 05b6c2123..96cf31277 100644 --- a/ext/tk/sample/tkextlib/treectrl/random.rb +++ b/ext/tk/sample/tkextlib/treectrl/random.rb @@ -184,7 +184,7 @@ def randomButton1(t, x, y) elsif id[0] == 'header' # Click in header - Tk::TreeCtrl::BindCallback.buttonPress1(w, x, y) + Tk::TreeCtrl::BindCallback.buttonPress1(t, x, y) else # Click in item |