gnope php gtk gui gnope.org  

gtk drop-down list

 
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners
View previous topic :: View next topic  
Author Message
cvcncfanatic



Joined: 21 Dec 2005
Posts: 4
Location: Belgium

PostPosted: Wed Dec 21, 2005 11:41 am    Post subject: gtk drop-down list Reply with quote

i know this is a stupid question, but i'm new to php-gtk (used to program command line programs), what class is used to make a drop-down list (like the ones in html made with <select>)
Back to top
cweiske



Joined: 08 Dec 2005
Posts: 454
Location: Leipzig/Germany

PostPosted: Wed Dec 21, 2005 12:59 pm    Post subject: Re: gtk drop-down list Reply with quote

cvcncfanatic wrote:
iwhat class is used to make a drop-down list (like the ones in html made with <select>)

GtkComboBox or GtkComboBoxEntry if you want editable entries. There is an example in the php-gtk2 demos delivered with gnope or the php-gtk cvs demo/ directory.
Back to top
Osiris



Joined: 17 Dec 2005
Posts: 65

PostPosted: Wed Dec 28, 2005 8:44 pm    Post subject: Reply with quote

Sorry for continue,

but the glade-Way isn't simple to do this or I'm failing?

So, my app doesn't throw an error on append_text but, there are no values in the list, after loading glade und setting the values in the list.

Or I'm to blind to see the function, to do this
(with GTKCombo, it was an easy way -> set_popdown_strings , but GtkCombo ist deprecated in GTK2 ....)

Greetings

Christian
Back to top
ron_t



Joined: 11 Dec 2005
Posts: 78
Location: Gatineau, Quebec

PostPosted: Wed Dec 28, 2005 11:45 pm    Post subject: Reply with quote

Osiris wrote:
Sorry for continue,
Or I'm to blind to see the function, to do this
(with GTKCombo, it was an easy way -> set_popdown_strings , but GtkCombo ist deprecated in GTK2 ....)

Christian


Here's how I figured out to do it:

Code:

<?php

if(!class_exists('gtk'))
{
   die('Please load the php-gtk2 module in your php.ini' . "\r\n");
}

$window = new GtkWindow();
$window->connect_simple("destroy", array("gtk", "main_quit"));

$vbox = new GtkVBox(false, 5);
$window->add($vbox);


//GtkComboBoxEntry
$comboentry = GtkComboBoxEntry::new_text();
$data = array('You', 'can', 'edit', 'this', 'box');

// put entries in the drop-down list of the combo
foreach ($data as $string)
{
   $comboentry->append_text($string);
}

$comboentry->get_child()->set_text('Type your own or select from the list.');
$vbox->pack_start($comboentry, false, true);

$window->show_all();

Gtk::main();

?>


-Ron T.
Back to top
Osiris



Joined: 17 Dec 2005
Posts: 65

PostPosted: Thu Dec 29, 2005 4:30 pm    Post subject: Reply with quote

Hello Ron,

you've described the normal way, creating the framework within the php-file.

I'm searching the glade-way to add items to a ComboBox, not to create the combobox in the php-file ad then add the items.

Greetings

Christian
Back to top
ron_t



Joined: 11 Dec 2005
Posts: 78
Location: Gatineau, Quebec

PostPosted: Thu Dec 29, 2005 4:32 pm    Post subject: Reply with quote

Osiris wrote:
Hello Ron,

you've described the normal way, creating the framework within the php-file.

I'm searching the glade-way to add items to a ComboBox, not to create the combobox in the php-file ad then add the items.



I misunderstood what you were looking for. As far as Glade stuff goes, I can't help you.

-Ron T.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    gnope.org Forum Index -> PHP GTK2 Beginners All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Templates enhanced by DigiWiki. Hosting by Tradebit.