Re: Editable SpinButton on a TreeView: detect *every* changes
- From: Tristan Van Berkom <tristan vanberkom codethink co uk>
- To: pozzugno <pozzugno gmail com>, gtk-app-devel-list gnome org
- Subject: Re: Editable SpinButton on a TreeView: detect *every* changes
- Date: Tue, 15 Nov 2016 14:27:18 +0900
Hi,
On Tue, 2016-11-15 at 02:09 +0100, pozzugno wrote:
[...]
I have tried to catch "editing_started", "editing_canceled" and
"edited"
signals of CellRenderer. In "editing_started" callback, I retrieve
and
save the row and column of the cell the user is going to edit. I
also
connect a callback to "value_changed" signal of the GtkAdjustment
associated to the GtkCellRendererSpin. Moreover I save the starting
value so I can restore it if the user will cancel the editing.
When the user clicks on +/- buttons, "value_changed" is called (so I
can
send the request to the remote device).
With some tricks, I'm able to restore the original value if the user
cancels the editing and to avoid a duplicate request to the remote
device when the user confirm the value changed by +/- buttons
(actually
when the user moves the focus away from the spinbutton, thus
terminated
the editing).
As you know, I'm very new to Gtk programming, so I'm wondering
wethere
there's a better approach.
Without reading your python code, your approach sounds correct.
If you want to get notifications (callbacks) for live editing of
editable widgets, you need to handle the editing started signal and
then handle signals on the editable widget which is created for that
edit session.
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]