note 92 added to gtk.gtkcombo.php
| From: | alan at akbkhome dot com | Date: | Tue, 29 Jan 2002 10:06:41 +0000 |
| Subject: | note 92 added to gtk.gtkcombo.php | ||
| Groups: | php.gtk.webmaster | ||
| Request: | Send a blank email to php-gtk-webmaster+get-255@lists.php.net to get a copy of this message | ||
combo trick...
unlike alot of other gtk objects that you can use (set/get)_data to store additional data,
combo is not that well endowed.
if you need to display a list, yet have id's associated with each item.
$array = array( 12=>"alpha", 13=>"alpha", 16=>"released");
$combo = &new GtkCombo();
$combo->set_popdown_strings(array_values($array));
$list = $combo->list; // the list that is associated with a combo
$list_keys = array_keys($array);
$list->connect('select-child', 'callback_select');
function callback_select($list,$listitem) {
global $list_keys
$line = $list->child_position($listitem);
echo "you picked". $list_keys[$line];
}
http://gtk.php.net/manual/en/gtk.gtkcombo.php