<?php
dl("php_gtk." . (strstr(PHP_OS, "WIN") ? "dll" :
"so"));
function print_this($list, $item) {
$label = $item->child;
echo $label->get()."\n";
flush();
}
$window = &new GtkWindow();
$window->set_position(GTK_WIN_POS_CENTER);
$window->connect_object("destroy", array("gtk",
"main_quit"));
$combo = &new GtkCombo();
$fruit = array('apples', 'bananas', 'cherries', 'damsons', 'eggplants',
'figs', 'grapes');
$combo->set_popdown_strings($fruit);
/* We don't have handles for these list items, so we connect them through the
GtkList. The child is passed to the callback with the select-child signal. */
$list = $combo->list;
$list->connect('select-child', 'print_this');
$window->add($combo);
$window->show_all();
gtk::main();
?>
|