1

I have a gtk3 window with a grid and some widgets for editing data. Some of the data is presented in a treeview. If the user makes changes to a field in the treeview then clicks on a save button the uncompleted edit is cancelled rather than saved. (If they click on another field the data is saved and I can later write it back to the liststore). How can I save the data when my save button is clicked?

Do I need to put a gtk.entry into the cellrenderer? Apply different properties to the cellrenderer (they are pretty much default, except set editable) Can I do this in a callback attached to the cellrenderer? or a different callback attached to the save button?

I read somewhere that the data being edited in the cell is held in a buffer, but I can't remember where I found this.

If there's an example in Go that would be great, but a solution in any language would point me in the right direction!

2
  • Please provide enough code so others can better understand or reproduce the problem. Commented Aug 9, 2024 at 6:23
  • I have been reminded that "when the treeview loses focus, the editing of a cell is cancelled. If the focus is still on the treeview when the editing is done, then the edited signal is emitted. You need to handle this one and update the liststore yourself. According to the docs: It is the responsibility of the application to update the model and store new_text at the position indicated by path. Commented Aug 10, 2024 at 1:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.