| View previous topic :: View next topic |
| Author |
Message |
cvcncfanatic
Joined: 21 Dec 2005 Posts: 4 Location: Belgium
|
Posted: Wed Dec 21, 2005 11:41 am Post subject: gtk drop-down list |
|
|
| 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
|
Posted: Wed Dec 21, 2005 12:59 pm Post subject: Re: gtk drop-down list |
|
|
| 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
|
Posted: Wed Dec 28, 2005 8:44 pm Post subject: |
|
|
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
|
Posted: Wed Dec 28, 2005 11:45 pm Post subject: |
|
|
| 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
|
Posted: Thu Dec 29, 2005 4:30 pm Post subject: |
|
|
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
|
Posted: Thu Dec 29, 2005 4:32 pm Post subject: |
|
|
| 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 |
|
 |
|