RE: Blocking signals




-----Original Message-----
From: Luca Cappa [mailto:luca cappa i-medlab com]
Sent: Thursday, February 24, 2005 10:56 AM
To: Prewitt, Nathan C ERDC-ITL-MS Contractor
Subject: Re: Blocking signals


Hello Nathan,

if in your case a set_value call trigs another set_value 
call, as could 
be using the gtkscale widget, you could avoid the need to block the 
emitting of the signal on the set_value method. Instead just 
put this in 
your code:

void setTheNewScaleValue (int i)
{
    if (i != actual_value)
    {
       actual_value = i;
       scale.set_value (actuall_value);
    }//if
}

Luca


    It's more a case of dependent widgets.  I have six sets of widgets with a
GtkEntry and a GtkHScale in each set.  The value in the Entry is the same as
the value of the HScale.  When the signal handler for the HScale is called, I
have to set the value of the Entry.  I have to block the signal handler for
the Entry to keep its signal handler from being called.  Likewise, when the
signal handler for the Entry is called, I have to set the value of the HScale
and block the signal handler for the HScale while I set it.  I ended up with
12 different callback functions, when I could have 2.  It is complicated
further by the fact that I have a SpinButton that allows me to change data
sets and this in turn changes the values and ranges in the Entry and HScale
widgets. 

Thanks,

Nathan



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