[Gtk-sharp-list] [Newbie] CellRendererText.Edited callback

Rafael Jannone jannone@inf.ufrgs.br
Wed, 18 Feb 2004 11:19:36 -0300


I had to use the CellRendererText.Edited callback recently.
It seems it could be made simpler.

This is the signature from EditedHandler:

public sealed delegate void EditedHandler (object o, EditedArgs args);

EditedArgs has those properties:
	- NewText: string
	- Path: string

Why doesn't EditedArgs present Path: TreePath instead?
Or it could even point directly to the cell, with a TreeIter.

My code ended up like this:

private void DescriptionEditedCB (object obj, EditedArgs args) {
	TreeIter iter;
	TreePath path = new TreePath(args.Path);
	store.GetIter(out iter, path);
	store.SetValue(iter, 1, args.NewText);

... which I guess is what most people will be doing.

Seems like an uneeded performance hit, since the CellRendererer knows
which cell is being edited after all.

Maybe I am doing something wrong (?). In that case please point me a
better way...

Rafael Jannone