Re: Sharing Gtk.Adjustment objects among several Gtk.SpinButton widgets



Hi;

On 14 November 2016 at 15:36, Pozz Pozz <pozzugno gmail com> wrote:
Is it possible to have a single Gtk.Adjustment for several Gtk.SpinButton
widgets? I couldn't understand if the adjustment is only used by SpinButton
to know the range (and some additional details, such as the page size), or
the adjustment is used also for the value storage place.

I tried to create two SpinButtons and to set a single adjustment, but it
seems to me changing the value of a SpinButton will change the value of the
other SpinButton too. So it seems it isn't possible to share one adjustment
among several widgets.

Of course, I'm supponsing the case of several parameters that have
different values but the same range properties (min, max, page step, ...)

A GtkAdjustment is a "model", whereas the widgets using the adjustment
are the "views". So, if you use the same GtkAdjustment instance, all
widgets will share the same underlying state. This is by design.

If you want to create different widgets with the same adjustment
parameters but not sharing the same state you will have to create
different GtkAdjustment instances — plausibly using a factory method.

Ciao,
 Emmanuele.

-- 
https://www.bassi.io
[@] ebassi [@gmail.com]


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