Re: Frist steps on PHP-GTK

From: Date: Wed, 25 Aug 2004 16:58:25 +0000
Subject: Re: Frist steps on PHP-GTK
References: 1 2 3  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5006@lists.php.net to get a copy of this message
Ricardo Cezar wrote:
Thank you Scott, now it works. It was a little confusing to me how to use widgets in my window, know I think I'm understanding. But I have another question to you: In my code I did not pass the third value to the method call, and it works well... But you use it. Why this third value means? My function: function today() {
    global $calendario;
    $calendario->select_month((date('n')-1), date('Y'));
    $calendario->select_day(date('d'));
} My function call: $botao1->connect('clicked', 'today'); Your function call:
$button->connect_object('clicked', 'hoje', $calendar);
The two methods are different. I used connect_object which passes a widget to the method when it is called. This allows my method to work on a widget without declaring it global. Using connect_object and a function that takes the widget as a parameter makes it a little easier to do things like clearing a form or when you aren't sure which widget will get changed until run time, etc... My today method would look like this: function today($widget) { $widget->select_month((date('n')-1), date('Y')); $widget->$calendario->select_day(date('d')); } Check out the manual page for connect_object http://gtk.php.net/manual/en/gtk.gtkobject.method.connect_object.php Scott Mattocks

« previous php.gtk.general (#5006) next »