Re: gtkliststore and gtkcombobox display column

From: Date: Thu, 31 Aug 2006 18:48:34 +0000
Subject: Re: gtkliststore and gtkcombobox display column
References: 1 2 3 4 5  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-7175@lists.php.net to get a copy of this message
Hi Steph, Thank you :) it works!... I've found something... when i call gtkcombobox->clear() before i append the text.. the combo will be reseted to empty box once again.. with list of blanks item i think the renderer gets removed off when called clear.. best regards, James ----- Original Message ----- From: "Steph Fox" <steph@zend.com> To: "james" <james@mercstudio.net>; <php-gtk-general@lists.php.net> Sent: Friday, September 01, 2006 2:22 AM Subject: Re: [PHP-GTK] gtkliststore and gtkcombobox display column > Taking the example from the manual > (http://gtk.php.net/manual/en/gtk.gtkcombobox.constructor.php) > and adapting it: > > // Create a model. > $listStore = new GtkListStore(Gtk::TYPE_STRING, Gtk::TYPE_STRING); > > // Add some values. > $listStore->append(array('New Jersey', 'a place')); > $listStore->append(array('New Mexico', 'another place')); > $listStore->append(array('New York', 'a third place')); > > // Set the model for the combo. > $combo->set_model($listStore); > > // Create a cell renderer. > $cellRenderer = new GtkCellRendererText(); > $cellRenderer2 = new GtkCellRendererText(); > > // Pack the cell renderer into the combo. > $combo->pack_start($cellRenderer); > $combo->pack_end($cellRenderer2); > > // Tell the combo where to get the text value of the cell renderer. > $combo->set_attributes($cellRenderer, 'text', 0); > $combo->set_attributes($cellRenderer2, 'text', 1); > > > ----- Original Message ----- > From: "james" <james@mercstudio.net> > To: <php-gtk-general@lists.php.net> > Sent: Thursday, August 31, 2006 8:10 PM > Subject: Re: [PHP-GTK] gtkliststore and gtkcombobox display column > > > > Hi Steph :) > > > > hm.. it wasn't the glade i'm having problem with. > > it's just that i'm unable to set the column to show for the gtkcombobox. > > > > if i create a gtkcombobox from __construct() > > > > and set the model to the GTKListStore.. > > > > how do i set it to display column 0 as it label for the list? > > > > > > p/s: the news group is down frequently :( > > i'm unable to post it there... > > > > best regards, > > > > James > > > > ----- Original Message ----- > > From: "Steph Fox" <steph@zend.com> > > To: "james" <james@mercstudio.net> > > Sent: Friday, September 01, 2006 12:11 AM > > Subject: Re: [PHP-GTK] gtkliststore and gtkcombobox display column > > > > > >> darn glade! :) > >> > >> I'm going to have to learn it one day. Sorry, can't help you with that > > stuff > >> right now - Anant or Scott probably can, so let them know this on the > >> list > >> or they'll think you're happy with my reply. > >> > >> nb I wrote the libglade wrapper, you'd think I'd know something about > >> what > >> it does...! > >> > >> - Steph > >> > >> ----- Original Message ----- > >> From: "james" <james@mercstudio.net> > >> To: "Steph Fox" <steph@zend.com> > >> Sent: Thursday, August 31, 2006 6:08 PM > >> Subject: Re: [PHP-GTK] gtkliststore and gtkcombobox display column > >> > >> > >> > Hi Steph, > >> > > >> > thanks for your advice, > >> > > >> > but i'm trying to do it from a glade object... > >> > so, i need to do it from the gtkcombobox inside the glade resource... > >> > > >> > > >> > ----- Original Message ----- > >> > From: ""Steph Fox"" <steph@zend.com> > >> > Newsgroups: php.gtk.general > >> > To: "james" <james@mercstudio.net> > >> > Cc: "PHP-GTK gen" <php-gtk-general@lists.php.net> > >> > Sent: Thursday, August 31, 2006 11:33 PM > >> > Subject: Re: [PHP-GTK] gtkliststore and gtkcombobox display column > >> > > >> > > >> >> Hi James, > >> >> > >> >> Forgive me if I'm way off target here, but it sounds to me like you're > >> >> over-complicating things? > >> >> > >> >> http://gtk.php.net/manual/en/gtk.gtkcombobox.constructor.new_text.php > >> >> > >> >> - Steph > >> >> > >> >> > >> >> "james" <james@mercstudio.net> wrote in message > >> >> news:68.A4.00880.E3007F44@pb1.pair.com... > >> >> > hi, > >> >> > > >> >> > i'm using php-gtk2 on windows... > >> >> > > >> >> > i've append the values into the gtkliststore, but when the combobox > >> > popup, > >> >> > it shows blank list, but there are items in it. > >> >> > > >> >> > how do i set the column index of the GtkComboBox to to show the > >> >> > index > > i > >> >> > requires? > >> >> > > >> >> > i've tried set_property( 'text', 0 ); and > >> >> > set_property('text-column', > >> > 0 ) > >> >> > but both does not work... > >> >> > > >> >> > how do i get the renderer for the combobox to set the property? > >> >> > > >> >> > thank you :) > >> >> > > >> >> > best regards, > >> >> > > >> >> > James > >> >> > > >> >> > -- > >> >> > PHP-GTK General Mailing List (http://gtk.php.net/) > >> >> > To unsubscribe, visit: > >> >> > http://www.php.net/unsub.php > >> >> > > >> > > >> > > >> > -- > >> > This message has been scanned for viruses and > >> > dangerous content by MailScanner, and is > >> > believed to be clean. > >> > > >> > > >> > __________ NOD32 1.1380 (20060125) Information __________ > >> > > >> > This message was checked by NOD32 antivirus system. > >> > http://www.eset.com > >> > > >> > > >> > >> > >> -- > >> This message has been scanned for viruses and > >> dangerous content by MailScanner, and is > >> believed to be clean. > >> > >> > > > > > > -- > > This message has been scanned for viruses and > > dangerous content by MailScanner, and is > > believed to be clean. > > > > -- > > PHP-GTK General Mailing List (http://gtk.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > __________ NOD32 1.1380 (20060125) Information __________ > > > > This message was checked by NOD32 antivirus system. > > http://www.eset.com > > > > > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.

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