note 69 added to gtk.gtkcombo.constructor.php

From: Date: Mon, 29 Oct 2001 20:51:04 +0000
Subject: note 69 added to gtk.gtkcombo.constructor.php
Groups: php.gtk.webmaster 
Request: Send a blank email to php-gtk-webmaster+get-135@lists.php.net to get a copy of this message
<?php // how to get values from a combo - sorry for the whole lot of code ;) function get_combo_selection($list, $listed) { global $status, $status_context, $items; $number = $list->child_position($listed); $status->push($status_context, "Selection: Array-Key:$number, Array-Val:$items[$number]" ); } $window = &new GtkWindow(); $window->set_default_size(250, 50); $window->connect_object('destroy', array('gtk', 'main_quit')); $vbox = &new GtkVBox(); $combo = &new GtkCombo(); $list = $combo->list; $items = array("First", "Second", "Third", "Fourth" ); $list_items = array(); foreach($items as $listed) { $show_items = $list_items[] = &new GtkListItem($listed); $show_items->show(); } if (count($list_items) > 0) $list->append_items($list_items); $list->set_selection_mode(GTK_SELECTION_SINGLE); $list->connect('select-child', 'get_combo_selection', $listed); $vbox->pack_start($combo); // some status information $status = &new GtkStatusbar(); $status_context = $status->get_context_id("foo"); $status->push($status_context, "Make a selection..."); $vbox->pack_start($status); $window->add($vbox); $window->show_all(); Gtk::main(); ?> http://gtk.php.net/manual/en/gtk.gtkcombo.constructor.php

« previous php.gtk.webmaster (#135) next »