How to make a NodeView cell retain the entered value after text's been entered through keyboard and the Edited event fired?
Whenever I enter some text into the cell and try to confirm that change, the old value that was there before my editing comes back.
The property of the subclass that should hold the value of a node never gets updated with the new value.
How do I get the text entered into a NodeView cell in the first place?
The trick is to use the
Pathproperty of theGtk.EditedArgsargument passed to your event handler to get the correct node from the store and modify (you're responsible to propagate the change from the UI to your model). A small, complete example follows.Given the following
Gtk.TreeNodeimplementation:it is easy to change the
Textproperty as follows:Note:
args.Pathto get the correctMyTreeNodefrom the store; andMyTreeNodeto be able to access theTextproperty.