From: Koji Arai Date: 2000-01-24T05:15:38+09:00 Subject: [ruby-list:20350] [PATCH] Ruby/Tk 新井です。 Ruby/Tkのパッチ(その1)です。 TkListbox#getの引数が2つの場合配列を返すようにしました。 require 'tk' list = TkListbox.new.pack list.insert 'end', "foo" list.insert 'end', "bar" list.insert 'end', "hoge hoge" p list.get 0, 'end' # p Tk.module_eval { tk_split_simplelist( list.get 0, 'end' )} p list.get 2 パッチ前 => "foo bar {hoge hoge}" "hoge hoge" パッチ後 => ["foo", "bar", "hoge hoge"] "hoge hoge" --- ext/tk/lib/tk.rb.old Thu Jan 20 04:17:07 2000 +++ ext/tk/lib/tk.rb Mon Jan 24 04:13:01 2000 @@ -2195,6 +2195,14 @@ def curselection list(tk_send('curselection')) end + def get(*index) + v = tk_send('get', *index) + if index.size == 1 + v + else + tk_split_simplelist(v) + end + end def nearest(y) tk_send('nearest', y).to_i end -- 新井康司 (Koji Arai)