ulli bei Unity
2018-11-16 18:48:43 UTC
Hello,
for some reasons I extend ruby GTK3 class with some functions. This works
very well with ruby-gtk3 2.2.5-4 build1. With ruby-gtk 3.2.4-1 I get
always the following error:
comboboxtext_mod.rb:8: warning: previous definition of ComboBoxText was here
Traceback (most recent call last):
comboboxtext_mod.rb:31:in `<main>': undefined method `set_names' for
#<Gtk::ComboBoxText:0x5628eabeb0e0 ptr=0x5628eb0102c0> (NoMethodError)
Did you mean? set_name
Cheers
#!/usr/bin/env ruby
require "gtk3"
require "pry"
class Gtk::ComboBoxText
def set_names aL
aL.each{|x| self.append_text x}
end
end
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() #(:entry => true)
@combo1.set_names ["foo", "bar", "fuga", "hoge"]
@combo1.active = 1
@combo1.signal_connect("changed") do
@combo1 = Gtk::ComboBoxText.new
@combo1.set_names ["moon", "mars"]
@combo1.active = 0
@combo1.remove_all
end
button = Gtk::Button.new(:label => "close")
button.signal_connect("clicked") do
@combo1.remove_all
#Gtk.main_quit
end
# Show main window
vbox = Gtk::Box.new(:vertical)
vbox.add(@combo1)
vbox.add(button)
window.add(vbox).show_all
Gtk.main
Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/
for some reasons I extend ruby GTK3 class with some functions. This works
very well with ruby-gtk3 2.2.5-4 build1. With ruby-gtk 3.2.4-1 I get
always the following error:
comboboxtext_mod.rb:8: warning: previous definition of ComboBoxText was here
Traceback (most recent call last):
comboboxtext_mod.rb:31:in `<main>': undefined method `set_names' for
#<Gtk::ComboBoxText:0x5628eabeb0e0 ptr=0x5628eb0102c0> (NoMethodError)
Did you mean? set_name
Cheers
#!/usr/bin/env ruby
require "gtk3"
require "pry"
class Gtk::ComboBoxText
def set_names aL
aL.each{|x| self.append_text x}
end
end
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() #(:entry => true)
@combo1.set_names ["foo", "bar", "fuga", "hoge"]
@combo1.active = 1
@combo1.signal_connect("changed") do
@combo1 = Gtk::ComboBoxText.new
@combo1.set_names ["moon", "mars"]
@combo1.active = 0
@combo1.remove_all
end
button = Gtk::Button.new(:label => "close")
button.signal_connect("clicked") do
@combo1.remove_all
#Gtk.main_quit
end
# Show main window
vbox = Gtk::Box.new(:vertical)
vbox.add(@combo1)
vbox.add(button)
window.add(vbox).show_all
Gtk.main
Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/