Force liststore to update when leaving treeview

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Force liststore to update when leaving treeview

Gtk+ - Apps Dev mailing list
Is this possible?

I have a (for example) a grid which contains
Various action widgets
And a Treeview based on a liststore

Is there any way to make sure that the changes made to a cell in the
liststore are "committed" if I click on one of the other widgets

I cant find anything to do this and if I leave the cell without pressing
enter or clicking on another cell, all changes are lost

thanks

Mike
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: Force liststore to update when leaving treeview

Gtk+ - Apps Dev mailing list
One idea is to hook the widget to the "leave-notify-event", which will
be triggered when the mouse leaves the widget.

On Tue, Feb 12, 2019 at 8:32 AM Mike Martin via gtk-app-devel-list
<[hidden email]> wrote:

>
> Is this possible?
>
> I have a (for example) a grid which contains
> Various action widgets
> And a Treeview based on a liststore
>
> Is there any way to make sure that the changes made to a cell in the
> liststore are "committed" if I click on one of the other widgets
>
> I cant find anything to do this and if I leave the cell without pressing
> enter or clicking on another cell, all changes are lost
>
> thanks
>
> Mike
> _______________________________________________
> gtk-app-devel-list mailing list
> [hidden email]
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: Force liststore to update when leaving treeview

Reuben Rissler
In reply to this post by Gtk+ - Apps Dev mailing list


On 02/12/2019 11:32 AM, Mike Martin via gtk-app-devel-list wrote:
> Is this possible?
Yes. I did this a while back, but would need to find an archive to
provide you with exact code.

>
> I have a (for example) a grid which contains
> Various action widgets
> And a Treeview based on a liststore
>
> Is there any way to make sure that the changes made to a cell in the
> liststore are "committed" if I click on one of the other widgets
>
> I cant find anything to do this and if I leave the cell without pressing
> enter or clicking on another cell, all changes are lost
Connect to the GtkCellRenderer "editing-started" signal. In that
callback, you will have an GtkEntry (GtkCellEditable) object. Connect to
the Entry's "changed" signal and keep a permanent string around with the
text the user is typing. Also preserve the path and column being edited
(obtained with "editing-started").

Also connect to GtkCellRenderer "editing-canceled" signal. In this
callback, use the path, column, and text you retained from
"editing-started", and update the ListStore.
>
> thanks
>
> Mike
> _______________________________________________
> gtk-app-devel-list mailing list
> [hidden email]
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>

_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: Force liststore to update when leaving treeview

Reuben Rissler
In reply to this post by Gtk+ - Apps Dev mailing list


On 02/12/2019 12:25 PM, Mitko Haralanov via gtk-app-devel-list wrote:
> One idea is to hook the widget to the "leave-notify-event", which will
> be triggered when the mouse leaves the widget.
Have you used this with a GtkTreeView? I mean, actually implemented what
Mike Martin is requesting?

>
> On Tue, Feb 12, 2019 at 8:32 AM Mike Martin via gtk-app-devel-list
> <[hidden email]> wrote:
>> Is this possible?
>>
>> I have a (for example) a grid which contains
>> Various action widgets
>> And a Treeview based on a liststore
>>
>> Is there any way to make sure that the changes made to a cell in the
>> liststore are "committed" if I click on one of the other widgets
>>
>> I cant find anything to do this and if I leave the cell without pressing
>> enter or clicking on another cell, all changes are lost
>>
>> thanks
>>
>> Mike
>> _______________________________________________
>> gtk-app-devel-list mailing list
>> [hidden email]
>> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> _______________________________________________
> gtk-app-devel-list mailing list
> [hidden email]
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>

_______________________________________________
gtk-app-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list