From: Hidetoshi NAGAI Date: 2005-06-06T16:44:44+09:00 Subject: Re: TkScrollbox with horizontal scrollbar From: Enrico Schwass Subject: TkScrollbox with horizontal scrollbar Date: Mon, 6 Jun 2005 15:59:06 +0900 Message-ID: <42A3F4A5.3060900@freenet.de> > I recently found this very useful widget TkScrollbar. It works great, if > you need a listbox with vertical scrollbar. > What I am missing is some more documentation. What, if i need a > horizontal bar or in my case both? Here you are. Please see "/ext/tk/sample/tktextframe.rb" also. ---------------------------------------------------- # require 'tk' class TkXYScrollbox1, 'minsize'=>0) TkGrid.columnconfigure(@frame, 0, 'weight'=>1, 'minsize'=>0) list.grid('row'=>0, 'column'=>0, 'sticky'=>'news') xscr.grid('row'=>1, 'column'=>0, 'sticky'=>'ew') yscr.grid('row'=>0, 'column'=>1, 'sticky'=>'ns') delegate('DEFAULT', list) delegate('foreground', list) delegate('background', list, xscr, yscr) delegate('borderwidth', @frame) delegate('relief', @frame) configure keys if keys end private :initialize_composite end ################################################ # test ################################################ if __FILE__ == $0 lst = TkXYScrollbox.new(:height=>7).pack ('A'..'Z').each_with_index{|s, n| lst.insert(:end, s*(n+1))} Tk.mainloop end ---------------------------------------------------- Of course, you can use a TkScrollbox with a horizontal scrollbar. However, probably you'll have some trouble on layouting them. It is better to define a new class which use grid geometry manager instead of pack geometry manager. -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)