logo       

Re: How to disable temporary callbacks using Glade?: msg#00062

gnome.gtk+.perl

Subject: Re: How to disable temporary callbacks using Glade?

ws wrote:
[...]
>
> sub on_CoEn_changed{
> print "..Combo-Entry changed by user and NOT during set-Operations";
> }
>
> sub setSelector{
> signal_handler_block(?);
> #how?
> $form->{'Co'} ->set_popdown_strings(@choice); #popDownList set
> $form->{'CoEn'} ->set_text($sv[2]); #e.g.
> value $sv[2] visible
> #bad:calls on_CoEn_changed
> signal_handler_unblock(?); #how?
> }
Hi,

You need to know the 'connection id' of the signal_connect call that
is triggering the handler. The connection id is returned by the
signal_connect() call so you do:

$id = $widget->signal_connect('changed', ......

and later:

$widget->signal_handler_block($id);

$id probably needs to be a global so that it is available in the handler.

Version 0.60 of Glade-Perl can generate code that saves the ids in a
predictable fashion so that you can use them in signal handlers like:

my $id = $form->{'__CONNECT_ID'}{'entry1'}{'after_key_press_event'}
$id = $widget->signal_connect('changed', ......
...

HTH, Dermot


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise