NYCPHP Meetup

NYPHP.org

[nycphp-talk] OO PHP-Gtk

Scott Mattocks crisscott at netzero.com
Thu Apr 15 08:55:59 EDT 2004


Hello,
I know that there is a list dedicated to this kind of stuff but 
apparently the folks at php-gtk don't like me very much because I can't 
post to their list and haven't heard back from the list administrator. 
Anyway, I figure there has to be some one on this list who can help me.

I have been trying to get an object oriented php-gtk app working but I
am running into some problems.  It appears that if you connect a widget
to a method, the method is called statically.  My problem is that I want
the methods to set member vars.  Is there any way to get something like
this to work:

<borrowed from php-gtk archives with modifictaions>
class clicky {
    var $wasClicked = FALSE;

    function clicky() {
        $button = &new GtkButton('Clicky!');
        $button->connect('clicked', array(&$this, 'clickied'));
    }
    function clickied() {
      if ($this->wasClicked) {
        echo 'The button was already clickied!';
      } else {
        echo 'This is the first time the button was clicked!';
        $this->wasClicked = TRUE;
      }
    }
}

$clicky = new clicky;
</borrowed from php-gtk archives with modifications>

Thanks,
Scott Mattocks





More information about the talk mailing list