Re: Glade signals
| From: | Markus Fischer | Date: | Mon, 07 Jan 2002 08:46:31 +0000 |
| Subject: | Re: Glade signals | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-969@lists.php.net to get a copy of this message | ||
On Mon, Jan 07, 2002 at 05:41:37AM -0300, Guilherme Ramos wrote :
> Is it possible to have different buttons using the same signal, to do
> different things in Glade?
> Let me explain..
>
> I have 4 dialog windows... in each one there is a CLOSE button.
> All the 4 buttons have the same signal, 'on_button_clicked'.
Doesn't mix up things. 'clicked' is a signal,
'on_button_clicked' is a handler.
> I go to my php, and create a function with this name, that..
> $dialog_name -> hide();
>
> This only works if before that I do something like..
> $dialog_name = $gx -> get_widget('dialog1');
>
> So.. my problem is that I want to use the same on_button_clicked function,
> and not be forced to define a variable with get_widget for each and every
> widget I want to use..
>
> Can't I make it on the fly?
>
> Function on_button_clicked($widget_name) {
> $wid = $gx -> get_widget($widget_name);
> $wid -> hide();
> }
>
> How can I send that variable, $widget_name, from within the Glade GUI
> (without need to code the variables)?
> Without glade this is possible!
Not the way you want to do it. Take a look at the arguments
you receive in your function with print_r(func_get_args()); .
However, you could use signal_autoconnect() to connect the
signals to this function and pass a different extra parameter
everytime by which you differentiate then which button has
been pressed.
--
Please always Cc to me when replying to me on the lists.