Re: changing a widgets callback function runtime
| From: | Steph | Date: | Sat, 11 Jan 2003 06:48:11 +0000 |
| Subject: | Re: changing a widgets callback function runtime | ||
| References: | 1 2 3 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2886@lists.php.net to get a copy of this message | ||
kind of ...... no you're way off track with set_args(), that's about
properties basically.
When you say 'once in a while' .. how's the button supposed to know when
that once in a while comes? Are there other indicators? Is there
timing? - because basically, unless I've misunderstood what you're
saying extremely badly, you're asking for a button with ESP, and afaik
Andrei hasn't gotten around to implementing that extension just yet..
Given history, I suspect I'm misunderstanding extremely badly :-\
----- Original Message -----
From: "firepage" <firepage@firepages.org>
To: "Steph" <sfox@php.net>; <php-gtk-general@lists.php.net>
Sent: Saturday, January 11, 2003 6:13 AM
Subject: Re: [PHP-GTK] changing a widgets callback function runtime
> you assume that I have a clue what I am trying to say :) sorry.....
>
> I have a button connected to a function like so
>
> function say_hello(){
> echo 'hello';
> }
> $but=&new GtkButton('hello');
> $but->connect('clicked','say_hello');
> $something->add($but);
>
> and thats fine for most of the script which says 'hello' a lot.
>
> but once or twice in the script I want to connect that buttons clicked
> signal to a different callback eg say_goodbye() instead of say_hello()
>
> I have plenty of ways around this ... eg setting a flag or variable
then...
>
> function say_hello(){
> global $flag;
> if($flag){
> echo 'hello';
> }else{
> echo 'toodle-pip!';
> }
> }
>
> but to avoid this (and other methods) I wondered if I could
programatically
> tell $button that now it has to call say_goodbye() when clicked
instead of
> say_hello() ? so change its callback for the 'clicked 'signal to a new
> function.
>
> I started looking at the gtkobject->get & set_args() in the GTK manual
but
> not sure if I am even warm looking there ?
>
> I hope that makes more sense?
>
> Regards,
> Simon.
>
> ----- Original Message -----
> From: "Steph" <sfox@php.net>
> To: "firepage" <firepage@firepages.org>;
<php-gtk-general@lists.php.net>
> Sent: Saturday, January 11, 2003 1:32 PM
> Subject: Re: [PHP-GTK] changing a widgets callbck function runtime
>
>
> > I don't think I'm alone in thinking 'huh?' here
> >
> > Can you be a bit more gentle with your explanations pls? :)
> >
> > ----- Original Message -----
> > From: "firepage" <firepage@firepages.org>
> > To: <php-gtk-general@lists.php.net>
> > Sent: Saturday, January 11, 2003 5:26 AM
> > Subject: [PHP-GTK] changing a widgets callbck function runtime
> >
> >
> > Hi,
> >
> > Is it possible to change the callback for a widgets signal after it
has
> > been set? eg if I
> >
> > $button->connect('clicked',callback);
> >
> > can I later override that default 'clicked' callback? I am currently
> > setting flags onclick and then running a switch inside the function
but
> > if I could change the callback it would be nice and lose a lot of
> > variable baggage.
> >
> > Regards,
> > Simon.
> >
> >
> >
> >
> >
> >
> >
>
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>