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
Path
property of theGtk.EditedArgs
argument 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.TreeNode
implementation:it is easy to change the
Text
property as follows:Note:
args.Path
to get the correctMyTreeNode
from the store; andMyTreeNode
to be able to access theText
property.