Re: How to fill a GtkList object ?
| From: | Lupine | Date: | Sun, 28 Jan 2007 18:32:07 +0000 |
| Subject: | Re: How to fill a GtkList object ? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7601@lists.php.net to get a copy of this message | ||
On Sun, 2007-01-28 at 10:23 -0800, localhost wrote:
> Hello all,
> Am new to php-gtk, i need to to fill in some items in the GtkList object, an
> example would be better than talking :
>
> public function sendSMS_clicked_cb() {
> $destAddresses = $this->glade->get_widget('destAddresses');// this is a
> GtkList object
>
> $model = new GtkListStore(Gtk::TYPE_STRING, Gtk::TYPE_LONG);
> $model->insert(0, array('Fourat', 20203060));
>
> }
>
> and now, how can i add the inserted items in $model into $destAddresses ?
This is how I usually do it:
function populate_cmbox_hostlist()
{
$hosts_cmbox = $this->glade->get_widget("host_entry_cmbox");//my
dropdown widget
$hostentries = new GtkListStore(Gtk::TYPE_STRING);
$hosts_array = array("hostip1","hostip2","hostip3");
foreach ($hosts_array as $hosts)
{
$hostentries->append(array($hosts));
}
$hosts_cmbox->set_model($hostentries);
$hosts_cmbox->set_text_column(0);
}
Hope that helps,
-Lup