GtkExpander Constructor

GtkExpander (string label);

Creates a new expander object using the parameter as the text of the label. The example below illustrates the usage of the constructor.

Example 62. Using Expander to Show/Hide details GtkExpander

<?php
//Creating the callbacks for handling basic window functions
function onDestroy()
{
    Gtk::main_quit();
}

//Creating and initialising a new window to add our expander to
$window = new GtkWindow();
$window->connect('destroy', 'onDestroy');
$window->set_title('GtkExpander Demo');
$window->set_default_size(250, 60);
$window->set_border_width(10);

//Creating a new expander object
$expander = new GtkExpander('Expander');

//Creating a label to store details
$label = new GtkLabel('Details can be shown or hidden');

//Adding the details to the expander
$expander->add($label);

//Adding the expander to the window
$window->add($expander);

//Displaying the window and starting the main loop
$window->show_all();
Gtk::main();
?>