Re: Can't quite get my head around this, can anyone help?



On Mon, Aug 10, 2009 at 02:52:56PM -0400, Boggess Rod wrote:
BTDT.  Won't work because by then, the user-value I'm trying not to
loose would already be lost.

It would not if you kept the original value elsewhere as suggested.

I would have thought this was a somewhat popular function, especially
when processing records from a database.  But I don't seem to know what
to search for.  I can seem to find one single example anywhere that
makes use of the change-value signal.

Databases have commit/rollback mechanisms so you usually don't need to
implement your own in Gtk+.  Even if they don't they can always serve as
the `elsehwere' that contains the original value.

The 'change-value' signal is not what you need.  The signal is something
few people need that's why you cannot find examples...

1) You have the original value because you had it when the dialog was
created.  You just need to keep it somewhere.  The simplest method is to
work on a copy of the dialog model (in MVC sense), leaving the original
intact.

2) When the user moves the slider, it should really move (so, no
'change-value').  Signal 'value-changed' is emitted and you change the
value in the dialog model working copy.

3) If the user accepts the changes replace the original model with the
values from the working copy.  If he does not just discard it.

Yeti




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