Re: glade + combo box
| From: | Madeleine D. | Date: | Wed, 15 Feb 2006 00:53:03 +0000 |
| Subject: | Re: glade + combo box | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-6736@lists.php.net to get a copy of this message | ||
Suomaf -
I'm not a glade user, so I'm probably not the best one for this, but here goes:
From a coding standpoint, I don't see anything that instantiates the item 'roles' inside your function 'on_button3_clicked'. You either need to pass it or globalize, or possibly create it inside your XML, but right at the moment, I don't see that it exists outside of Gtk::main, which would justify the error message of a non-object.
Try something like this:
$window=&new GladeXML("./interface/gms.glade");
$window->signal_autoconnect();
$combo = &new GtkCombo();
$comboEntry = $combo->entry;
$roles = array ("supervisor","production","planning");
$comboEntry->set_popdown_strings($roles);
.... etc.....
function on_button3_clicked() {
global $window,$comboEntry;
$container = $window->get_widget("entry3");
$login = $container->get_text();
$container = $window->get_widget("entry4");
$password = $container->get_text();
$role = $comboEntry->get_text();
printf("$login\n"); \
printf("$password\n");
printf("$role\n");
}
The main thing to remember is that objects created inside Gtk::main don't automatically exist elsewhere.
Hope that helps.
Madeleine D.
suomaf wrote:I apologise if this is the wrong place for this question. What i am trying to do is be able to get the entry widget so asto get thetext that it contains. I read somewhere that we have to code thecombo box,and not able to use glade to put it into the interface. I want tobe able toget the 3 variables login, password and supervisor and pass themto afucntion that will log me into a database. At present i am ableto get loginand password. its just role that i cannot get to. I tried toset_name on thecombo box, the list and the entry and I still get the followingerror when irun the script. PHP Fatal error: Call to a member function on a non-object in /home/sso/my-documents/my-projects/gms/gms.php on line 41 Thank you kindly suomaf