Re: I need a short example of $object->block() & $object->unblock()...

From: Date: Wed, 18 Jul 2001 13:12:18 +0000
Subject: Re: I need a short example of $object->block() & $object->unblock()...
References: 1  Groups: php.gtk 
Request: Send a blank email to php-gtk+get-2259@lists.php.net to get a copy of this message
Have a bit of code. Still can't get signal_handler_pending() to work, it returns zero which is then declared illegal, but the block/unblock and disconnect/connect do good things using the signal connection id (still confused over this one!). <? dl('php_gtk.' . (strstr(PHP_OS, 'WIN') ? 'dll' : 'so')) || die("Can't load php_gtk module!\n"); $i = 0; $i = (int)$i; function firstfunction() { global $i, $button, $sid; if ($i == 0) { $button->signal_handler_block($sid); } $i++; if($i == 3) { $button->signal_handler_unblock($sid); } } function myfunction() { global $i; echo "It wasn't blocked this time!"."\t".$i."\n"; } $window = &new GtkWindow(); $window->set_title("testbay window"); $window->set_position(GTK_WIN_POS_CENTER); $window->connect_object('destroy', array('gtk', 'main_quit')); $window->show(); $button = &new GtkButton("This button will only work\nfrom the third time you click it"); $button->connect('clicked', 'firstfunction'); $sid = $button->connect('clicked', 'myfunction'); $window->add($button); $button->show(); $window->show_all(); Gtk::main(); ?> alternative firstfunction() for disconnect: function firstfunction() { global $i, $button, $sid; if ($i == 0) { $button->disconnect($sid); } $i++; if($i == 3) { $button->connect('clicked', 'myfunction'); } } ----- Original Message ----- From: "Mauro Ferreira" <mauroferreira@enersulnet.com.br> To: "php-gtk list" <php-gtk@lists.php.net> Sent: Tuesday, July 17, 2001 11:13 PM Subject: Re: [PHP-GTK] I need a short example of $object->block() & $object->unblock()... OOps... disconsider the last... the right is: I tryed this: 55| $this->selRow = $this->clist->connect('select_row',array($this,'rowSelected')); 56| $this->selCol = $this->clist->connect('click_column',array($this,'columnClicked')); /* some code */ 78| $this->clist->disconnect($this->selCol); 79| $this->clist->disconnect($this->selRow); and give this: PHP Warning: disconnect() expects argument 1 to be integer, null given in C:\www\phpgtk\projects\core\results\generated.phpg on line 78 PHP Warning: disconnect() expects argument 1 to be integer, null given in C:\www\phpgtk\projects\core\results\generated.phpg on line 79 What i did wrong ? All this are inside the same class... -- PHP GTK Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-gtk-unsubscribe@lists.php.net For additional commands, e-mail: php-gtk-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.gtk (#2259) next »