| | |
php-gtk
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
I have just started learning php-gtk 2 but am a bit stuck. First is that are there any php-gtk 2 debuggers or error loggers that I can use because at the moment, if there is a bug in my script, the exported exe file made from my php-gtk script is simply currupted or won't open. So does any body know of such program to read my script and tell if there are bugs and what roughly lines the bugs are on. Note: This is php-gtk - not plain php.
Also I have encountered a multi object problem where only the first button will be displayed on the screen. Below is the code I am using and do you know why the button $button2 wont show.
In case if you are wondering what php-gtk is, it is like php but with more libraries/binaries and instead of creating webpages, it creates programs.
Also I have encountered a multi object problem where only the first button will be displayed on the screen. Below is the code I am using and do you know why the button $button2 wont show.
PHP Syntax (Toggle Plain Text)
<?php function pressed() { echo "Hello again - The button was pressed!\n"; } function pressed2() { echo "Hello again - The button was pressed!\n"; } $window = new GtkWindow(); $window->resize(800,600); $window->set_title('My Diary'); $window->connect_simple('destroy', array('Gtk', 'main_quit')); $button1 = new GtkButton('Jan'); $button1->connect_simple('clicked', 'pressed'); $button1parrent = new GtkAlignment(0, 0, 0.01, 0.01); $button1parrent->add($button1); $window->add($button1parrent); $button2 = new GtkButton('February'); $button2->connect_simple('clicked', 'pressed2'); $button2parrent = new GtkAlignment(0, 0, 0.01, 0.01); $button2parrent->add($button2); $window->add($button2parrent); $window->show_all(); //$window->set_resizable(false); Gtk::main(); ?>
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
•
•
Join Date: Aug 2007
Posts: 189
Reputation:
Solved Threads: 14
I've fixed your code:
I'm learning php-gtk too
It seems like is mandatory to enclose UI elements into boxes before adding to GtkWindow.
I recommend to read this serie of tutorials:
http://gtk.php.net/manual/en/tutorials.packing.php
php Syntax (Toggle Plain Text)
<?php if (!class_exists('gtk')) { die("Please load the php-gtk2 module in your php.ini\r\n"); } function pressed() { echo "Hello again - The button was pressed!\n"; } function pressed2() { echo "Hello again - The button was pressed!\n"; } $window = new GtkWindow(); $window->resize(800,600); $window->set_title('My Diary'); $window->connect_simple('destroy', array('Gtk', 'main_quit')); $button1 = new GtkButton('Jan'); $button1->connect_simple('clicked', 'pressed'); $button1parrent = new GtkAlignment(0, 0, 0.01, 0.01); $button1parrent->add($button1); $button2 = new GtkButton('February'); $button2->connect_simple('clicked', 'pressed2'); $button2parrent = new GtkAlignment(0, 0, 0.01, 0.01); $button2parrent->add($button2); $buttonbox = new GtkVButtonBox(); // or GtkHButtonBox for horizontal placement $buttonbox->add($button1parrent); $buttonbox->add($button2parrent); $window->add($buttonbox); $window->show_all(); //$window->set_resizable(false); Gtk::main(); ?>
I'm learning php-gtk too
It seems like is mandatory to enclose UI elements into boxes before adding to GtkWindow.I recommend to read this serie of tutorials:
http://gtk.php.net/manual/en/tutorials.packing.php
Last edited by martin5211; Dec 6th, 2008 at 8:52 pm.
Yes, It works.
Thanks. My current code is below and displays a row of buttons at the top. The only other thing I need to know is if there is any software that will display the error messages from any errors in my php file. I have tried enabling error reporting in the php.ini file of the compilation but makes no difference but other than that it works great and love the tutorials you linked to.
Below code does the job:
Thanks. My current code is below and displays a row of buttons at the top. The only other thing I need to know is if there is any software that will display the error messages from any errors in my php file. I have tried enabling error reporting in the php.ini file of the compilation but makes no difference but other than that it works great and love the tutorials you linked to.
Below code does the job:
php Syntax (Toggle Plain Text)
<?php if (!class_exists('gtk')) { die("Please load the php-gtk2 module in your php.ini\r\n"); } function pressed() { echo "Hello again - The button was pressed!\n"; } function pressed2() { echo "Hello again - The button was pressed!\n"; } $window = new GtkWindow(); $window->resize(800,600); $window->set_title('My Diary'); $window->connect_simple('destroy', array('Gtk', 'main_quit')); $button1 = new GtkButton('January'); $button1->connect_simple('clicked', 'pressed'); $button2 = new GtkButton('February'); $button2->connect_simple('clicked', 'pressed2'); $button3 = new GtkButton('March'); $button3->connect_simple('clicked', 'pressed2'); $button4 = new GtkButton('April'); $button4->connect_simple('clicked', 'pressed2'); $button5 = new GtkButton('May'); $button5->connect_simple('clicked', 'pressed2'); $button6 = new GtkButton('June'); $button6->connect_simple('clicked', 'pressed2'); $button7 = new GtkButton('July'); $button7->connect_simple('clicked', 'pressed2'); $button8 = new GtkButton('August'); $button8->connect_simple('clicked', 'pressed2'); $button9 = new GtkButton('September'); $button9->connect_simple('clicked', 'pressed2'); $button10 = new GtkButton('October'); $button10->connect_simple('clicked', 'pressed2'); $button11 = new GtkButton('November'); $button11->connect_simple('clicked', 'pressed2'); $button12 = new GtkButton('December'); $button12->connect_simple('clicked', 'pressed2'); $buttonbox = new GtkHButtonBox(); // or GtkHButtonBox for horizontal placement $buttonbox->add($button1); $buttonbox->add($button2); $buttonbox->add($button3); $buttonbox->add($button4); $buttonbox->add($button5); $buttonbox->add($button6); $buttonbox->add($button7); $buttonbox->add($button8); $buttonbox->add($button9); $buttonbox->add($button10); $buttonbox->add($button11); $buttonbox->add($button12); $buttonboxparrent = new GtkAlignment(0, 0, 0.01, 0.01); $buttonboxparrent->add($buttonbox); $window->add($buttonboxparrent); $window->show_all(); //$window->set_resizable(false); Gtk::main(); ?>
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
•
•
Join Date: Aug 2007
Posts: 189
Reputation:
Solved Threads: 14
I'm using the php executable from Terminal to load the php-gtk code (located in /usr/local/php-gtk in my Mac OS 10.5 after installing this DMG package).
Before compiling the code you can perform
Before compiling the code you can perform
php -l code_example.php to check for syntax errors (maybe, we can do it automatically from the editor assigning a macro or menu function). In Windows should work exactly as described here, also it's possible to perform and interpret the code, showing errors and output messages on the MS-DOS prompt using directly php code_example.php alone without -l parameter. Last edited by martin5211; Dec 7th, 2008 at 2:43 pm.
•
•
•
•
Originally Posted by martin5211
I'm using the php executable from Terminal to load the php-gtk code (located in /usr/local/php-gtk in my Mac OS 10.5 after installing this DMG package).
PHP Syntax (Toggle Plain Text)
@echo - @php -l index.php @echo ------------------------------- @pause
So *Solved*
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
•
•
Join Date: Aug 2007
Posts: 189
Reputation:
Solved Threads: 14
Also, this modification can be useful adding an argument to the ms-dos, avoiding copy&paste each file name:
PHP Syntax (Toggle Plain Text)
@echo off echo - php -l %1 echo ------- pause
![]() |
Similar Threads
- Your thought on PHP (IT Professionals' Lounge)
- Senior GTK+ Developer - Irvine, CA (Software Development Job Offers)
- How to build a executable aplication that use PHP,MySQL and Apache (PHP)
- New to databases (MySQL)
- Installing GTK and MinGW in Windows (C)
- Sql??????? (PHP)
- gtk.ComboBox (Python)
- Separate C and C++ forum? (C++)
Other Threads in the PHP Forum
- Previous Thread: Pop up and Email Reminder in agenda
- Next Thread: i nd help in update n delete on php.
| Thread Tools | Search this Thread |
apache api array beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external file files folder form forms forum freelancing function functions google header headmethod howtowriteathesis href htaccess html iframe image include incode insert ip javascript joomla limit link login mail malfunction menu method mlm mod_rewrite multiple mysql neutrality oop pageing paypal pdf php phpmysql play problem query question radio random recursion recursiveloop remote root script search select server sessions sms soap source space sql support! syntax system table template tutorial update upload url validator variable video web youtube






