Gtk::VolumeButton how to change value without emmiting signal?

View: New views
4 Messages — Rating Filter:   Alert me  

Gtk::VolumeButton how to change value without emmiting signal?

by sledge hammer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
I am using a Gtk::VolumeButton. I want to change it's value without emmiting singal_value_changed. Is this possible?


Σύρετε φωτογραφίες στο παράθυρο του Messenger. Δείτε πώς. Κάντε κλικ εδώ!
_______________________________________________
gtkmm-list mailing list
gtkmm-list@...
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Re: Gtk::VolumeButton how to change value without emmiting signal?

by Mark Roberts-10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear Sledge Hammer,

> I am using a Gtk::VolumeButton. I want to change it's value without
> emmiting singal_value_changed. Is this possible?

I am interested what the list will answer.

I had the same question a few years ago and found that it was the wrong
question. My situation was this: when a value changes (triggered by
network, program logic, or however) the GUI needs to be updated, and
updating the GUI of course changes the value. This leads to a recursive
infinite loop.

Your problem might be a different one. The solution I used was this: the
function Value::set() (which will be called by the singal_value_changed
handler) does nothing if there is nothing to be done:

Value< T>::set( const T &t)
{
   if (_t != t)
   {
     _t = t;
     UpdateGUI();
   }
}

Hope this helps,
Mark
_______________________________________________
gtkmm-list mailing list
gtkmm-list@...
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Re: Gtk::VolumeButton how to change value without emmiting signal?

by Armin Burgmeier :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Mark Roberts wrote:

> Dear Sledge Hammer,
>
>> I am using a Gtk::VolumeButton. I want to change it's value without
>> emmiting singal_value_changed. Is this possible?
>
> I am interested what the list will answer.
>
> I had the same question a few years ago and found that it was the wrong
> question. My situation was this: when a value changes (triggered by
> network, program logic, or however) the GUI needs to be updated, and
> updating the GUI of course changes the value. This leads to a recursive
> infinite loop.

I normally keep a sigc::connection for my signal handler to the
value_changed() signal and whenever I want to change the value
programatically I use a connection.block()/connection.unblock() pair to
prevent the signal handler from running.

Armin
_______________________________________________
gtkmm-list mailing list
gtkmm-list@...
http://mail.gnome.org/mailman/listinfo/gtkmm-list

RE: Gtk::VolumeButton how to change value without emmiting signal?

by sledge hammer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
To the list:

I actually didn't need it. I had forgotten what my handler was doing. I thought I had a possible infinite loop. But all I need to do was change the value and my handler would do the additional gui work without recursion.

But I would be interesting if there is a solution to this problem. The other 2 solutions mentioned by the others are interesting though.


Μείνετε συνδεδεμένοι με τους φίλους σας στο Zoo Κάντε κλικ εδώ!
_______________________________________________
gtkmm-list mailing list
gtkmm-list@...
http://mail.gnome.org/mailman/listinfo/gtkmm-list