glade + combo box
| From: | suomaf | Date: | Tue, 14 Feb 2006 05:16:59 +0000 |
| Subject: | glade + combo box | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-6731@lists.php.net to get a copy of this message | ||
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 as to get the
text that it contains. I read somewhere that we have to code the combo box,
and not able to use glade to put it into the interface. I want to be able to
get the 3 variables login, password and supervisor and pass them to a
fucntion that will log me into a database. At present i am able to get login
and password. its just role that i cannot get to. I tried to set_name on the
combo box, the list and the entry and I still get the following error when i
run 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
This is the php file that i am trying to make work
< ?php
if (!class_exists('gtk'))
{
if (strtoupper(substr(PHP_OS, 0,3) == 'WIN'))
dl('php_gtk.dll');
else
dl('php_gtk.so');
}
$window=&new GladeXML("./interface/gms.glade");
$window->signal_autoconnect();
$combo = &new GtkCombo();
$combo->set_name("combo");
$entry = $combo->entry;
$entry->set_name("roles");
printf($entry->get_name(). "\n"); // This also works so I think the name has
already been set
$roles = array ("supervisor","production","planning");
$combo->set_popdown_strings($roles);
$list = $combo->list;
$list->connect('select-child','print_this');
$hbox = $window->get_widget("hbox9");
$hbox->add($combo);
$hbox->show_all();
//printf($entry->get_text()); This acutally works at this point
function on_button3_clicked()
{
global $window;
$container = $window->get_widget("entry3");
$login = $container->get_text();
$container = $window->get_widget("entry4");
$password = $container->get_text();
$container = $window->get_widget("roles");
$role = $container->get_text();
//$role = $container->get_name();
printf("$login\n"); //this works
printf("$password\n"); //this also works
printf("$role\n"); // i believe that this is generating the error
}
function on_button4_clicked()
{
Gtk::main_quit();
}
function on_window1_destroy()
{
Gtk::main_quit();
}
Gtk::main();
?>
This is the glade file i am using: gms.glade
< ?xml version="1.0"?>
< GTK-Interface>
< project>
< directory> < /directory>
< source_directory>src < /source_directory>
< pixmaps_directory>pixmaps < /pixmaps_directory>
< language>C < /language>
< gnome_support>False < /gnome_support>
< gettext_support>True < /gettext_support>
< /project>
< widget>
< class>GtkWindow < /class>
< name>window1 < /name>
< signal>
< name>destroy < /name>
< handler>on_window1_destroy < /handler>
< last_modification_time>Mon, 13 Feb 2006 07:36:45 GMT <
/last_modification_time>
< /signal>
< title> < /title>
< type>GTK_WINDOW_TOPLEVEL < /type>
< position>GTK_WIN_POS_NONE < /position>
< modal>False < /modal>
< allow_shrink>False < /allow_shrink>
< allow_grow>True < /allow_grow>
< auto_shrink>False < /auto_shrink>
< widget>
< class>GtkVBox < /class>
< name>vbox1 < /name>
< border_width>4 < /border_width>
< homogeneous>True < /homogeneous>
< spacing>4 < /spacing>
< widget>
< class>GtkLabel < /class>
< name>label6 < /name>
< label>welcome to gms < /label>
< justify>GTK_JUSTIFY_CENTER < /justify>
< wrap>False < /wrap>
< xalign>0.5 < /xalign>
< yalign>0.5 < /yalign>
< xpad>0 < /xpad>
< ypad>0 < /ypad>
< child>
< padding>0 < /padding>
< expand>False < /expand>
< fill>False < /fill>
< /child>
< /widget>
< widget>
< class>GtkHBox < /class>
< name>hbox5 < /name>
< border_width>4 < /border_width>
< homogeneous>True < /homogeneous>
< spacing>4 < /spacing>
< child>
< padding>0 < /padding>
< expand>True < /expand>
< fill>True < /fill>
< /child>
< widget>
< class>GtkLabel < /class>
< name>label3 < /name>
< label>user : < /label>
< justify>GTK_JUSTIFY_RIGHT < /justify>
< wrap>False < /wrap>
< xalign>0.5 < /xalign>
< yalign>0.5 < /yalign>
< xpad>0 < /xpad>
< ypad>0 < /ypad>
< child>
< padding>0 < /padding>
< expand>True < /expand>
< fill>True < /fill>
< /child>
< /widget>
< widget>
< class>GtkEntry < /class>
< name>entry3 < /name>
< can_focus>True < /can_focus>
< editable>True < /editable>
< text_visible>True < /text_visible>
< text_max_length>0 < /text_max_length>
< text> < /text>
< child>
< padding>0 < /padding>
< expand>True < /expand>
< fill>True < /fill>
< /child>
< /widget>
< /widget>
< widget>
< class>GtkHBox < /class>
< name>hbox6 < /name>
< border_width>4 < /border_width>
< homogeneous>True < /homogeneous>
< spacing>4 < /spacing>
< child>
< padding>0 < /padding>
< expand>True < /expand>
< fill>True < /fill>
< /child>
< widget>
< class>GtkLabel < /class>
< name>label4 < /name>
< label>password : < /label>
< justify>GTK_JUSTIFY_RIGHT < /justify>
< wrap>False < /wrap>
< xalign>0.5 < /xalign>
< yalign>0.5 < /yalign>
< xpad>0 < /xpad>
< ypad>0 < /ypad>
< child>
< padding>0 < /padding>
< expand>True < /expand>
< fill>True < /fill>
< /child>
< /widget>
< widget>
< class>GtkEntry < /class>
< name>entry4 < /name>
< can_focus>True < /can_focus>
< editable>True < /editable>
< text_visible>True < /text_visible>
< text_max_length>0 < /text_max_length>
< text> < /text>
< child>
< padding>0 < /padding>
< expand>True < /expand>
< fill>True < /fill>
< /child>
< /widget>
< /widget>
< widget>
< class>GtkHBox < /class>
< name>hbox7 < /name>
< border_width>4 < /border_width>
< homogeneous>True < /homogeneous>
< spacing>0 < /spacing>
< child>
< padding>0 < /padding>
< expand>True < /expand>
< fill>True < /fill>
< /child>
< widget>
< class>GtkLabel < /class>
< name>label5 < /name>
< label>role : < /label>
< justify>GTK_JUSTIFY_RIGHT < /justify>
< wrap>False < /wrap>
< xalign>0.5 < /xalign>
< yalign>0.5 < /yalign>
< xpad>0 < /xpad>
< ypad>0 < /ypad>
< child>
< padding>0 < /padding>
< expand>True < /expand>
< fill>True < /fill>
< /child>
< /widget>
< widget>
< class>GtkHBox < /class>
< name>hbox9 < /name>
< homogeneous>False < /homogeneous>
< spacing>0 < /spacing>
< child>
< padding>0 < /padding>
< expand>True < /expand>
< fill>True < /fill>
< /child>
< widget>
< class>Placeholder < /class>
< /widget>
< /widget>
< /widget>
< widget>
< class>GtkHBox < /class>
< name>hbox8 < /name>
< border_width>4 < /border_width>
< homogeneous>False < /homogeneous>
< spacing>4 < /spacing>
< child>
< padding>0 < /padding>
< expand>True < /expand>
< fill>True < /fill>
< /child>
< widget>
< class>GtkButton < /class>
< name>button3 < /name>
< can_focus>True < /can_focus>
< signal>
< name>clicked < /name>
< handler>on_button3_clicked < /handler>
< last_modification_time>Mon, 13 Feb 2006 08:45:22 GMT <
/last_modification_time>
< /signal>
< label>_login < /label>
< relief>GTK_RELIEF_NORMAL < /relief>
< child>
< padding>0 < /padding>
< expand>True < /expand>
< fill>True < /fill>
< /child>
< /widget>
< widget>
< class>GtkVSeparator < /class>
< name>vseparator1 < /name>
< child>
< padding>0 < /padding>
< expand>False < /expand>
< fill>False < /fill>
< /child>
< /widget>
< widget>
< class>GtkButton < /class>
< name>button4 < /name>
< can_focus>True < /can_focus>
< signal>
< name>clicked < /name>
< handler>on_button4_clicked < /handler>
< last_modification_time>Mon, 13 Feb 2006 07:35:15 GMT <
/last_modification_time>
< /signal>
< label>_close < /label>
< relief>GTK_RELIEF_NORMAL < /relief>
< child>
< padding>0 < /padding>
< expand>True < /expand>
< fill>True < /fill>
< /child>
< /widget>
< /widget>
< /widget>
< /widget>
< /GTK-Interface>
--
View this message in context: http://www.nabble.com/glade-%2B-combo-box-t1118912.html#a2925519
Sent from the Php - GTK - General forum at Nabble.com.