Re: Signal disconnecting



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


As you said it's obvious, hopelessly I can't go that way as I have to
change the callback on the button only when what I'm doing in the original
callback succeeds.

What I want to do is :

In my function NewCustomer, I have a  button which alls the
\&SaveCustomer function. If this function successfully save the
data, I rename the button to 'Create a new customer' and connect it to the
NewCustomer function.

It works, but my only problem is that the first connected signal is still
emited, so it tries to save the customer's data again and then calls the
NewCustomer function.

Fred.


On Sat, 16 Aug 2003, Ross McFarland wrote:

On Sat, 2003-08-16 at 16:24, Fred. Oger wrote:
My problem I would like to reassign the function called when a button is
hit a second time, so then disconnect would be done in the callback
function to which I can't pass the $handler_id.
That's the reason I was looking for the disconnect_by_func.

I'll try to find another solution.

that should be easy enough to get around, sorry if i'm stating the
obvious:

my $yet = 1;
$widget->signal_conect( clicked => sub{
      if( $first )
      {
              # first time stuff
              $first = 0;
      }
      else
      {
              # every other time
      }
} );

-rm


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/PppIgcR1FkaCE7oRAvDxAJoDuCSKE+Ndjf4toLmLbUyemONduQCfb4P7
7tNHDRTkAdE749thqEw5svg=
=bsZt
-----END PGP SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]