From: "Alan (Ursus Major)" Date: 2002-10-31T17:19:26+09:00 Subject: Re: working with super? mentored in message news:20021031132836S.nagai@ai.kyutech.ac.jp... > Hi, > > > The super(@ff, keys) calls TkListbox#initialize method. > It does NOT call TkListbox#new method. > TkListbox#initialize method does not use the given block. > So, the block isn't evaluated. > It took me a /long/ time to realize that the block in the 'super' call was being ignored. I never /did/ figure out why. Domo arigato, tomidachi! I ended up with this snippet: --------------------------- def initialize(parent = nil, keys = nil) super(parent, keys) # if ya wanna scroll, baby, ya need a scroll'em @sb = TkScrollbar.new(@frame, 'command'=>proc{|*args| self.yview *args}){ pack('side'=>'right', 'fill'=>'y') } self.yscrollcommand(proc{|first,last| @sb.set(first,last)}) TkFont.families.each{|fname| self.insert('end', fname.chomp) } end --------------------------- > But, I think that it is better to use TkComposite module. > tkscrollbox.rb is a sample to use the module, Ah yes. I'm glad I didn't know about that. This was a learning exercise in using inheritance in Ruby, so if I had know about that, I would certainly have cheated! > > --------------------------------- > require 'tkscrollbox' > fb = TkScrollbox.new.pack > TkFont.families.each{|fname| fb.insert('end', fname.chomp)} > Tk.mainloop > --------------------------------- > -- > Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) Thank you again, Alan Walkington