[Gtk-sharp-list] Start editing with one click in a TreeView

Christian Hoff christian_hoff at gmx.net
Tue Apr 1 01:26:54 EDT 2008


Florian Roth schrieb:
> Hi,
>
> I'm currently working with a TreeView which has three colums. The last column is editable and uses a CellRendererText therefor. Now I want to make this cell column to start editing as soon as i click on it. I already tried severals things. First a tried to use a ButtonPress event an then somehow toggle the editing. This didn't work because no ButtonPress events were recieved. Then I tried it with the OnCursorChanged method of the tree view. This event works and I even can check which column the user clicked on with the GetCursor(out path, out column) method. But I have absolutly no idea how to start the editing now. I played around with the Activate method of the renderer, but this didn't work.
> I hope someone here can help me.
>
> Regards,
> Florian Roth
>   
Have a look at
http://www.mono-project.com/GtkSharp_TreeView_Tutorial#Editable_Text_Cells

You are right, catching a mouse click with the Activate() method won't
work because it cannot be overridden. This can be really annoying when
you want to write custom CellRenderers. I will try to extend the
Gtk.metadata file to provide a virtual method OnActivate() which can
then be used to catch these clicks.

Christian Hoff



More information about the Gtk-sharp-list mailing list