ext/tk/lib/tkscrollbox.rb
DEFINITIONS
This source file includes following functions.
1 #
2 # tkscrollbox.rb - Tk Listbox with Scrollbar
3 # as an example of Composite Widget
4 # $Date: 1999/08/13 05:37:52 $
5 # by Yukihiro Matsumoto <matz@netlab.co.jp>
6
7 require 'tk.rb'
8
9 class TkScrollbox<TkListbox
10 include TkComposite
11 def initialize_composite(keys=nil)
12 list = TkListbox.new(@frame)
13 scroll = TkScrollbar.new(@frame)
14 @path = list.path
15
16 list.configure 'yscroll', scroll.path+" set"
17 list.pack 'side'=>'left','fill'=>'both','expand'=>'yes'
18 scroll.configure 'command', list.path+" yview"
19 scroll.pack 'side'=>'right','fill'=>'y'
20
21 delegate('DEFAULT', list)
22 delegate('foreground', list)
23 delegate('background', list, scroll)
24 delegate('borderwidth', @frame)
25 delegate('relief', @frame)
26
27 configure keys if keys
28 end
29 end