I'd like to learn how to convert a class to a widget. Is there someone who can help me with this? The Ruby tutorial on this subject hasn't been written yet. I'd like to write that section using listbox.rb as an example.
on 04.10.2007 22:39
on 04.10.2007 23:07
Your class should be a child of Gtk::TreeView, not Gtk::Widget. Updated example attached. Mathieu
on 05.10.2007 01:08
Mathieu Blondel wrote: > Your class should be a child of Gtk::TreeView, not Gtk::Widget. Updated > example attached. > > Mathieu Thanks, Mathieu! That takes care of the reason it wouldn't run. But, does the fact that TreeView is a widget automatically make ListBox a widget?
on 05.10.2007 17:50
Alan Lake wrote: > Mathieu Blondel wrote: > > Thanks, Mathieu! That takes care of the reason it wouldn't run. But, > does the fact that TreeView is a widget automatically make ListBox a > widget? > Yes it is because Gtk::TreeView is itself a Gtk::Widget (and otherwise you wouldn't be able to add your ListBox object to the window). Have a look at the object hierarchy of a Gtk::TreeView: http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3ATreeView mathieu@mathieulaptop:~$ irb irb(main):001:0> require "gtk2" => true irb(main):002:0> Gtk::TreeView.ancestors => [Gtk::TreeView, Gtk::Container, Gtk::Widget, Atk::Implementor, GLib::Interface, GLib::MetaInterface, Gtk::Object, GLib::InitiallyUnowned, GLib::Object, GLib::Instantiatable, Object, Kernel] irb(main):003:0> tv = Gtk::TreeView.new => #<Gtk::TreeView:0xb67d37d0 ptr=0x8328120> irb(main):004:0> tv.is_a? Gtk::Widget => true HTH, Mathieu