Setting an objects method as callback function ?
| From: | Markus Fischer | Date: | Sun, 08 Apr 2001 12:58:09 +0000 |
| Subject: | Setting an objects method as callback function ? | ||
| Groups: | php.gtk | ||
| Request: | Send a blank email to php-gtk+get-1315@lists.php.net to get a copy of this message | ||
Ok,
I've banging my head not so often lately against my screen than
against my desk. Anyway I can't solve this stupid problem and am
horibly stuck :
Within an class I create my gui stuff :
class gtkError extends phpError {
var $shutdownFunc;
function gtkError() {
phpError::phpError();
$this->shutdownFunc = 'Gtk::main_quit();';
}
function registerShutdown( $shutdown) {
$this->shutdownFunc = $shutdown;
}
function flush() { // yes, named like the php func but works
.
.
.
$w = &new GtkWindow();
$w->connect( 'delete-event', $this->shutdownFunc);
$w->show();
}
}
The class is then used like :
.
.
$this->gtkError->registerShutdown( &$this->shutdown);
if( $somethingbroken)
$this->gtkError->flush();
else
$this->mainGui->build();
Gtk::main();
.
.
The Problem is the line
·$this->gtkError->registerShutdown( &$this->shutdown);
I don't know whats the right syntax to pass the shutdown function
to registerShutdown. I tried
&$this->shutdown
&$this->shutdown()
'$this->shutdown'
'$this->shutdown()'
'Mainclass::shutdown'
'Mainclass::shutdown()'
( Mainclass is the class calling gtkError)
but nothing really works, some give error even.
Can someone help me out please ?
thanks,
Markus
--
Markus Fischer, http://josefine.ben.tuwien.ac.at/~mfischer/
EMail: mfischer@josefine.ben.tuwien.ac.at
PGP Public Key: http://josefine.ben.tuwien.ac.at/~mfischer/C2272BD0.asc
PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0