Re: set_error_handler()
| From: | Alan Knowles | Date: | Mon, 26 May 2003 23:49:21 +0000 |
| Subject: | Re: set_error_handler() | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-3482@lists.php.net to get a copy of this message | ||
Jonas Koch Bentzen wrote:
Did any of you succeed in using a class method (with a GTK+ window) as a callback for set_error_handler()? I can't seem to make it work, no matter where I place set_error_handler(). This is my error handling method: function error($type, $message) {have you tried adding gtk::main() here?$window = new GtkWindow(); $window->set_modal(TRUE); $window->set_default_size(250, 50); $window->set_title('Error');$frame = new GtkFrame(); $frame->set_shadow_type(GTK_SHADOW_OUT);$label = new GtkLabel('An error occured. Details:'."\n\n".$message);$frame->add($label); $window->add($frame);$window->show_all();
} I call it in the constructor using the following code: set_error_handler(array(&$this, 'error')); Naturally, the error handling method is dependant upon gtk::main() to have been called. The weird thing is, even if an error occurs after the main window has opened (and gtk::main() has been called), the error method still doesn't work: The error message is just displayed in the command line window - the error isn't being handled by the error() method. The full source code is available at http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ufup/ufup/lib/gui.php?rev=1.14&content-type=text/vnd.viewcvs-markup