Problem clearing elements from Gtk::ComboBox

Hi everybody.

I have a little problem with version 0.15 of Ruby-Gtk2. Look at this
class:


class BotonOpciones < Gtk::ComboBox
def initialize(valores=nil, inicial=nil)
super()
aniadir_opciones(valores, inicial) if valores
end

# Esta función está separada para que se puedan cambiar las
# opciones todas las veces que sea necesario.
    def aniadir_opciones(valores,
	inicial=nil)

	model.clear	# HERE IS THE PROBLEM!!!!!!
            @valores = valores
            @valores.each do |v|
		append_text(v)
	end
	if inicial
		poner_valor(inicial)
	end
end

end

When I try “model.clear”, get the error:

`aniadir_opciones': undefined method `clear' for
#<#<Class:0xb6750eac>:0xb66c6f90 ptr=0x85c6790> (NoMethodError)

It worked until 0.14 version, and API documentation doesn’t show any
deprecation or change.

Is this a known problem? Perhaps a bug?

Thank you.

						David

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

have you tried having a set_model(Gtk::ListStore) after your super() ?
try ‘p model.inspect’ or ‘p model.methods’ before your model.clear, to
see, if there’s a model assigned.

El lunes 25 de septiembre, Dobai-Pataky B.
escribió:> have you tried having a set_model(Gtk::ListStore) after your super() ?

If I do that, get:

(eval):2:in `set_property': Class isn't supported (TypeError)

try ‘p model.inspect’ or ‘p model.methods’ before your model.clear, to
see, if there’s a model assigned.

I think there isn’t. This is result from inspect:

"#<#<Class:0xb681ce58>:0xb6794058 ptr=0x85c5790>"

							David

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

El lunes 25 de septiembre, Dobai-Pataky B.
escribió:> set_model(@mymodel)
Ops! I wanted going too fast 0:)

Thank you for your ideas. Only a last question. If I destroy
Gtk.ComboBox, is respective Gtk.ListStore destroyed?

							David

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys – and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs