Re: combo with auto-complete

From: Date: Mon, 31 May 2004 14:13:43 +0000
Subject: Re: combo with auto-complete
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4593@lists.php.net to get a copy of this message
ops... Forgot the mail system removes the attached files :( <? # ComboEasy, Combo Class # with auto-completion # by Pablo Dall'Oglio # pablo@solis.coop.br // Carrega a biblioteca do php-gtk dl('php_gtk.' . PHP_SHLIB_SUFFIX); # class ComboEasy with # auto-completion class GtkComboEasy extends GtkCombo { # Construct method function GtkComboEasy($window, $array) { GtkCombo::GtkCombo(); GtkCombo::set_popdown_strings($array); // Get the Entry $Entry = $this->entry; // Set the focus $window->set_focus($Entry); $Entry->set_text(''); GtkCombo::set_focus_child($Entry); $Entry->connect_object_after('changed', array(&$this, "Filter")); // Array of combo options $this->array = $array; } # Changes the text function Set($text) { // Set the text without // passing by callback $entry = $this->entry; $entry->unset_flags(GTK_CONNECTED); $entry->set_text($text); $entry->set_flags(GTK_CONNECTED); } # Called after each change function Filter() { $entry = $this->entry; $text = $entry->get_text(); $len = strlen(trim($text)); $array = $this->array; $entry->unset_flags(GTK_CONNECTED); if ($len>1) { // seek at the option foreach ($array as $element) { if (substr($element,0,$len) == $text) { Gtk::timeout_add(1, array($this, 'Set'), $element); Gtk::timeout_add(1, array($entry, 'select_region'), $len, -1); break; } } } $entry->set_flags(GTK_CONNECTED); } } # Creates the mail window $window = new GtkWindow; $window->realize(); $array = array ('aerosvaldo', 'geringonca', 'cruznovaldina'); $comboeasy = &new GtkComboEasy($window, $array); $window->add($comboeasy); $window->show_all(); gtk::main(); ?> On Mon, 31 May 2004 11:10:56 -0300 "Pablo Dall'Oglio" <pablo@solis.coop.br> wrote: > Hello People > > I've just created a extended class for GtkCombo with auto-completion... The File follows > attached... > > the best regards > Pablo > > :: Pablo Dall'Oglio +55 (51) 3714-6653 > :: Solis - Cooperativa de Solucoes Livres > :: www.solis.coop.br - Lajeado, RS - Brasil > :: www.varianet.com.br (personal) > :: "Life's a Journey, Not a Destination" - Steven Tyler > > :: Pablo Dall'Oglio +55 (51) 3714-6653 :: Solis - Cooperativa de Solucoes Livres :: www.solis.coop.br - Lajeado, RS - Brasil :: www.varianet.com.br (personal) :: "Life's a Journey, Not a Destination" - Steven Tyler

« previous php.gtk.general (#4593) next »