Re: Signal disconnecting
- From: Ross McFarland <rwmcfa1 neces com>
- To: "Fred. Oger" <oger sia ucl ac be>
- Cc: Gtk-Perl-List <gtk-perl-list gnome org>
- Subject: Re: Signal disconnecting
- Date: 16 Aug 2003 17:29:24 -0400
On Sat, 2003-08-16 at 16:55, Fred. Oger wrote:
-----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.
if i under stand what you're looking to do:
# saved means that customer is saved and the button is creating new
# if not saved then the button saves the customer
my $saved = 0;
$button->signal_connect( clicked => sub {
if( $saved )
{
create_new_customer(...);
$button->set_label('Save customer');
$saved = 0;
}
else
{
if( $saved = save_customer(...) )
{
$button->set_label('Create new customer');
}
}
});
if not sorry.
-rm
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]