Forum: Ruby-Gnome 2 Size of a Gtk::Expander

Posted by Vincent Carmona (vinc-mai)
on 2009-12-17 16:20
Hi Gnomer!

I try to resize a window after I unexpand a Gtk::Expander. The window
show a empty place where the hidden child of the expander is supposed to
be. I do not know if it is the expected behaviour or a bug.

A quick code to demonstrate :

require 'gtk2'

e=Gtk::Expander.new("toto")
e.add(Gtk::Label.new("toto"))
w=Gtk::Window.new
w.add(e)
w.show_all
e.signal_connect('activate'){|widget| w.resize(w.size[0], 1)}

Gtk.main

A quick workaround :

require 'gtk2'

l=Gtk::Label.new("toto")
e=Gtk::Expander.new("toto")
b=Gtk::VBox.new
b.pack_start(e)
b.pack_start(l)
w=Gtk::Window.new
w.add(b)
w.show_all
l.hide
e.signal_connect('notify::expanded'){|widget, foo|
  if widget.expanded?
    l.show
  else
    l.hide
    w.resize(w.size[0], 1)
  end
}

Gtk.main
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.