From: "Alan (Ursus Major)" Date: 2002-10-31T09:58:56+09:00 Subject: working with super? Folks: The following doesn't produce a visible scroll bar, but if I rewrite it slighlty so that it calls TkListbox directly, it shows it. What am I doing wrong here? ---------- require 'tk' class FontBox < TkListbox def initialize(parent = nil, keys=nil) @ff = TkFrame.new super(@ff, keys) {|l| TkScrollbar.new(@ff, 'command'=>proc{|*args| l.yview *args}) {|s| pack('side'=>'right', 'fill'=>'y') l.yscrollcommand(proc{|first,last| s.set(first,last)}) } pack('side'=>'right', 'fill'=>'both', 'expand'=>'yes') } @ff.pack TkFont.families.each{|fname| self.insert('end', fname.chomp) } end end fb = FontBox.new.pack Tk.mainloop --------------------------------- The following does show the scroll bar class FontBox < TkListbox def initialize(parent = nil, keys=nil) @ff = TkFrame.new # the difference is here \/ @lb = TkListbox.new(@ff, keys) {|l| TkScrollbar.new(@ff, 'command'=>proc{|*args| l.yview *args}) {|s| pack('side'=>'right', 'fill'=>'y') l.yscrollcommand(proc{|first,last| s.set(first,last)}) } pack('side'=>'right', 'fill'=>'both', 'expand'=>'yes') } @ff.pack class FontBox < TkListbox def initialize(parent = nil, keys=nil) @ff = TkFrame.new @lb = TkListbox.new(@ff, keys) {|l| TkScrollbar.new(@ff, 'command'=>proc{|*args| l.yview *args}) {|s| pack('side'=>'right', 'fill'=>'y') l.yscrollcommand(proc{|first,last| s.set(first,last)}) } pack('side'=>'right', 'fill'=>'both', 'expand'=>'yes') } @ff.pack TkFont.families.each{|fname| @lb.insert('end', fname.chomp) } end end fb = FontBox.new Tk.mainloop end end fb = FontBox.new Tk.mainloop ------------------ Thanks, Alan Walkington