GTK3 ruby comboboxtext: remove text items

ulli bei Unity <[email protected]>
Newsgroups gmane.comp.lang.ruby.general
Message-ID <[email protected]>

Hello,

I am using GTK3 ruby 2.5. My problem I want do delete the list.

I already checked: remove_all, and combobox.model.clear

but nothing works.

How can I delete the Textlist.


Cheers



#!/usr/bin/env ruby


require "gtk3"
require "pry"

if str = Gtk.check_version(3, 10, 7)
   puts "This sample requires GTK+ 3.10.7 or later"
   puts str
   exit
end

window = Gtk::Window.new("Gtk::ComboBox sample")
window.signal_connect("destroy") {Gtk.main_quit}

#
# Text only
#
combo1 = Gtk::ComboBoxText.new
["foo", "bar", "fuga", "hoge"].each do |val|
   combo1.append_text(val)
end
combo1.active = 1

combo1.signal_connect("changed") do
   p "combo1: #{combo1.active}, #{combo1.active_iter[0]}"
     combo1.active = 1
end



# Show main window
vbox = Gtk::Box.new(:vertical)
vbox.add(combo1)
window.add(vbox).show_all

Gtk.main



Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.