Re: php-gtk glade question
| From: | Mike Hostetler | Date: | Fri, 13 Feb 2004 18:43:44 +0000 |
| Subject: | Re: php-gtk glade question | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-4397@lists.php.net to get a copy of this message | ||
Stefan-
Not completely sure about your question, but one thing you might look at is the AppWizard program. I can't recal the name of the gentleman that wrote it, but I highly admire him for his work with PHP-GTK. The link to the program is http://www.cweiske.de/phpgtk_appwizard.htm
Basically, it takes a glade file and generates a basic class to get you started. This has been very helpful to me.
Mike
stefan bogdan wrote:
hello i'm new in php-gtk . i have a glade file like: <?xml version="1.0"?> <GTK-Interface> <project> <name>Project5</name> <program_name>project5</program_name> <directory></directory> <source_directory>src</source_directory> <pixmaps_directory>pixmaps</pixmaps_directory> <language>xml</language> <gnome_support>False</gnome_support> <gettext_support>False</gettext_support> </project> <widget> <class>GtkWindow</class> <name>pagina</name> <width>802</width> <height>600</height> <title>pagina pricipala</title> <type>GTK_WINDOW_TOPLEVEL</type> <position>GTK_WIN_POS_CENTER</position> <modal>False</modal> <allow_shrink>False</allow_shrink> <allow_grow>False</allow_grow> <auto_shrink>False</auto_shrink> <widget> <class>GtkFixed</class> <name>fixed1</name> <widget><class>GtkFrame</class> <name>frame1</name> <x>17</x> <y>37</y> <width>192</width> <height>88</height> <label_xalign>0</label_xalign> <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type><widget><class>GtkVBox</class> <name>vbox1</name> <homogeneous>False</homogeneous> <spacing>0</spacing> <widget><class>GtkHBox</class> <name>hbox1</name> <homogeneous>False</homogeneous> <spacing>0</spacing> <child> <padding>0</padding> <expand>True</expand> <fill>True</fill> </child><widget> <class>GtkLabel</class> <name>label2</name> <label>label2</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>GtkAlignment</class> <name>alignment1</name> <xalign>0.5</xalign> <yalign>0.5</yalign> <xscale>1</xscale> <yscale>1</yscale> <child> <padding>0</padding> <expand>True</expand> <fill>True</fill> </child><widget> <class>GtkEntry</class> <name>entry1</name> <can_focus>True</can_focus> <has_focus>True</has_focus> <events>GDK_ENTER_NOTIFY_MASK</events> <extension_events>GDK_EXTENSION_EVENTS_ALL</extension_events> <signal> <name>changed</name> <handler>on_entry_changed</handler> <last_modification_time>Fri, 13 Feb 2004 17:25:52 GMT</last_modification_time> </signal> <signal> <name>focus_out_event</name> <handler>on_entry_focus_out_event</handler> <last_modification_time>Fri, 13 Feb 2004 17:34:52 GMT</last_modification_time> </signal> <signal> <name>insert_text</name> <handler>on_entry_insert_text</handler> <last_modification_time>Fri, 13 Feb 2004 17:52:52 GMT</last_modification_time> </signal> <signal> <name>activate</name> <handler>on_entry_activate</handler> <last_modification_time>Fri, 13 Feb 2004 18:24:46 GMT</last_modification_time> </signal> <editable>True</editable> <text_visible>True</text_visible> <text_max_length>0</text_max_length> <text></text> </widget> </widget></widget> <widget><class>GtkHBox</class> <name>hbox2</name> <homogeneous>False</homogeneous> <spacing>0</spacing> <child> <padding>0</padding> <expand>True</expand> <fill>True</fill> </child><widget> <class>GtkLabel</class> <name>label3</name> <label>label3</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>GtkEntry</class> <name>entry2</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>hbox3</name> <homogeneous>False</homogeneous> <spacing>0</spacing> <child> <padding>0</padding> <expand>True</expand> <fill>True</fill> </child><widget> <class>GtkLabel</class> <name>label4</name> <label>label4</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>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></widget> <widget><class>GtkLabel</class> <name>label1</name> <x>28</x> <y>21</y> <width>119</width> <height>18</height> <label>prima incercare</label> <justify>GTK_JUSTIFY_CENTER</justify> <wrap>False</wrap> <xalign>0.5</xalign> <yalign>0.5</yalign> <xpad>0</xpad> <ypad>0</ypad></widget> <widget><class>GtkButton</class> <name>button2</name> <x>120</x> <y>136</y> <width>57</width> <height>24</height> <can_focus>True</can_focus> <label>button2</label></widget> <widget><class>GtkButton</class> <name>button3</name> <x>64</x> <y>136</y> <width>49</width> <height>24</height> <can_focus>True</can_focus> <signal><name>clicked</name> <handler>on_button_clicked</handler> <last_modification_time>Fri, 13 Feb 2004 15:18:25 GMT</last_modification_time></signal> <label>button3</label></widget> </widget> </widget> </GTK-Interface> and this simple php code: <?php dl( "php_gtk." . ( strstr( PHP_OS, "WIN") ? "dll" : "so")); function on_button_clicked() { echo "Clicked\n"; gtk::main_quit(); } function my_on_entry_focus_out_event($entry){ echo "am trecut"; $numar=number_format( $entry->get_text(),2,',','.'); $entry->set_text($numar); $entry->grab_focus(); } $gx = &new GladeXML('d:\php-gtk\test\project5.glade'); //$gx->signal_autoconnect(); $entry=$gx->get_widget("entry1"); $gx->signal_connect_object("on_entry_focus_out_event","my_on_entry_focus_out_event",$entry); $window=$gx->get_widget("pagina"); $window->connect_object("destroy",array("gtk","main_quit")); gtk::main(); ?> when i'm using connect to on_entry_focus_out the my_on_entry fuction doesn't work $entry ->get_text() is not recognized. what i'm doing wrong?? thanks