From: "H.Yamamoto" Date: 2005-08-01T10:46:36+09:00 Subject: [ruby-dev:26665] Re: refactoring tcltklib.c (deleted ip check) 山本です。 あと、大したものじゃないんですが、tcl/tk の tile のデモにあって ruby/tk のデモになかったコンボボックスを追加してみました。本当は ツリービューを追加したかったのですが、とりあえず簡単な方から。 Index: demo.rb =================================================================== RCS file: /src/ruby/ext/tk/sample/tkextlib/tile/demo.rb,v retrieving revision 1.5 diff -u -w -b -p -r1.5 demo.rb --- demo.rb 27 Jul 2005 01:57:14 -0000 1.5 +++ demo.rb 27 Jul 2005 03:18:43 -0000 @@ -301,6 +301,8 @@ def makeNotebook nb.add(client, :text=>'Demo', :underline=>0) nb.select(client) + combo = Tk::Tile::TFrame.new(nb) + nb.add(combo, :text=>'Combobox', :underline=>7) others = Tk::Tile::TFrame.new(nb) nb.add(others, :text=>'Others', :underline=>4) nb.add(Tk::Tile::TLabel.new(nb, :text=>'Nothing to see here...'), @@ -308,10 +310,10 @@ def makeNotebook nb.add(Tk::Tile::TLabel.new(nb, :text=>'Nothing to see here either.'), :text=>'More Stuff', :sticky=>:se) - [nb, client, others] + [nb, client, combo, others] end -nb, client, others = makeNotebook() +nb, client, combo, others = makeNotebook() # # Side-by side check, radio, and menu button comparison: @@ -537,6 +539,19 @@ menu.add(:cascade, :label=>'Theme', :und setTheme($V[:THEME]) # +# Combobox demo pane: +# +values = %w(list abc def ghi jkl mno pqr stu vwx yz) +cbs = Array.new(2) { + cb = Tk::Tile::TCombobox.new( + combo, :values=>values, :textvariable=>$V.ref(:COMBO)) + cb.pack(:side=>:top, :padx=>2, :pady=>2, :expand=>false, :fill=>:x) + cb +} +cbs[1].state :readonly +cbs[0].current = 3 + +# # Other demos: # $Timers = {:StateMonitor=>nil, :FocusMonitor=>nil}