Create  Edit  FrontPage  Index  Search  Changes  History  RSS  Login

tut-gtk2-contwidg-expanders

Expanders


contwidg-expanders.png

The Gtk::Expander container can have only a single child. The child can be displayed or hidden. You can show or hide the child by the triangle to the left of the expander's label. A before and after the click scenrios are shown on the figure.

#!/usr/bin/env ruby
require 'gtk2'

window = Gtk::Window.new
window.set_border_width 10
window.set_size_request 200, -1
window.set_title "Expanders"

window.signal_connect('delete_event') { false }
window.signal_connect('destroy') { Gtk.main_quit }

expander = Gtk::Expander.new "Click _Me For More!"
label = Gtk::Label.new "Hide me or show me,\nthat is your choice."
expander.add label

# make the child (label) visible
expander.expanded = true

window.add expander
window.show_all
Gtk.main
Last modified:2012/07/12 01:14:53
Keyword(s):
References:[tut-gtk] [tut-gtk2-contwidg]