Re: How to stop signal in the folowing case?

On 2004.05.11 14:01 Paul Davis wrote:

this doesn't cause never ending recursion if MY_VALUE is a single
value. gtk_spin_button_set_value (foo, val) does nothing if "val" is
equal to the current value.

this is a classic problem for Model-View-Controller programming, and
blocking the signal is not normally the right way to deal with it.

It isn't? Oh dear.

I have a very similar problem at the moment with a model containing
a floating point variable and two controllers: a GtkHScale and a
GtkSpinButton. The controllers are added to the model as subscribers.
This works fine if you use the spin button to change the variable -
the hscale moves to match and it all looks very nice. Clicking in the
gutter of the hscale also works. The problem is if you move the hscale
by dragging it. This causes an oscillation between two values (one
int and a close floating point number). I assume that the spin button
is reacting to having it's adjustment set to a non-integer value by
rounding it and something similar is happenind with the hscale.

I was planning to simply lock the value in the model during the
publishing phase to solve the problem, but it sounds as though that
might not be the best approach. So, what _should_ I be doing?


J. Ali Harlow
ali juiblex co uk

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