From: Jacek Podkanski Date: 2002-02-04T12:37:26+09:00 Subject: Gtk::Clist question Hi, Does anyony know whats wrong. I get following error, but from Gtk Reference I could expect a Fixnum, if I understood it right (which I doubt), but this expects some Object, so what should i do to be able to remove a row from a Clist. Regards, Jacek error message ../list_maker.rb:58:in `remove': wrong argument type Fixnum (expected Object) (TypeError) from ./list_maker.rb:58:in `initialize' from ./list_maker.rb:57:in `call' from ./list_maker.rb:92:in `main' from ./list_maker.rb:92:in `initialize' from ./list_maker.rb:96:in `new' from ./list_maker.rb:96 proble line in the script below is marked with #################### error ######### my script #!/usr/bin/ruby require 'gtk' class ListMaker def initialize(prompt) print "jestem w initialize of listmaker class\n" window=Gtk::Window.new(Gtk::WINDOW_TOPLEVEL) vb=Gtk::VBox.new(false,3) vb.show l=Gtk::Label.new(prompt) l.show vb.pack_start(l,false,true,0) #list will go here clist = Gtk::CList.new(1) clist.set_usize(300, 200) clist.set_column_width 0, 100 clist.append ['this is what i put in the list','second row'] clist.append ['second row'] clist.signal_connect('select_row') {|w, row, col, e| @row=row #print clist.get_text(row,col),"\t" print "you have selected row ",row,"\n" } vb.pack_start(clist,false,true,0) clist.show en=Gtk::Entry.new en.show vb.pack_start(en,false,true,0) hb=Gtk::HBox.new(true,3) hb.show bup=Gtk::Button.new('up') bup.show bup.signal_connect('clicked') { clist.swap_rows(@row,@row-1) clist.select_row(@row-1,0) } bdown=Gtk::Button.new('down') bdown.show bdown.signal_connect('clicked') { clist.swap_rows(@row,@row+1) clist.select_row(@row+1,0) } badd=Gtk::Button.new('Add') badd.show badd.signal_connect('clicked') { clist.append [en.get_text] print clist.rows,"\n" } bdel=Gtk::Button.new('Del') bdel.show bdel.signal_connect('clicked') { clist.remove(@row) #################### error ######### } hb.pack_start(bup,false,true,0) hb.pack_start(bdown,false,true,0) hb.pack_start(badd,false,true,0) hb.pack_start(bdel,false,true,0) vb.pack_start(hb,false,true,0) button=Gtk::Button.new('Done') button.signal_connect('clicked') { rl=[] for r in 0..clist.rows-1 rl << clist.get_text(r,0) end print rl.inspect,"\n" window.destroy Gtk.main_quit } button.show vb.pack_start(button,false,true,0) window.signal_connect('destroy') { #print "destroy\n" Gtk.main_quit #jak uzyjesz tej komendy to wykonasz instrokcje po Gtk.main #exit #exit program } window.add(vb) window.show Gtk.main end end if $0==__FILE__ o=ListMaker.new('fill the list') end -- Jacek Podkanski