[Gtk-sharp-list] Overriding default behaviour of a cellrenderertext

Christian Hoff christian_hoff at gmx.net
Fri Jul 25 04:25:31 EDT 2008


Looks like the event is not passed to the Entry. Pressing "return" in
the entry should definetly fire an edited event. Although I have no idea
how to handle key events in Gtk, is it possible that you have overriden
some sort of OnKeyPress method in the TreeView? If you don't call
base.OnKeyPress the TreeView will never get notified about the pressed
key; if the Entry is a child widget if the TreeView it may not receive
the event as well.

But that's just pure speculation. If you really want to bring light into
the dark, you should have a look into the the Gtk+ code of the entry or
create your own class derived from Gtk.CellRendererText, override the
OnEditingStartedMethod, call base.OnEditingStarted from this context and
attach some useful signal handlers to the returned entry of the base
method to see whether it gets an event when "return" is pressed.

Christian
> I have written a simple data grid using a treeview and underlying list 
> store due to the fact that there is not one in GTK# and the Medsphere 
> one does not allow editing (and the documentation is *very* poor).  
> Basically I have a key press handler on the main window that allows 
> the user to use the Insert and Del keys to insert and delete rows 
> respectively.  The ones that I am having problems with are the 
> Return/Enter key (to move down one 'row' and to add a new row if at 
> the last row) and Tab (to move to the next column and put the cell in 
> edit mode).  The problem is that when you Return or Tab it takes you 
> to the correct cell etc, but the previous cell you have just processed 
> does not fire the Edited event for the cell renderer - and thus I 
> cannot save the processed text in the list store.  I have tried other 
> keys with the result being the same.  Does anybody have an idea why it 
> is behaving like this given that if I mouse click to a different cell 
> then the Edited event is fired - thus allowing things to work.  I 
> understand that there is an Entry that underlies the cell renderer 
> text - but couldn't see what I could change there (if I connected to 
> the 'start edit' event and then used the 'args.editable' member) so 
> that seemed to be a dead end as well.




More information about the Gtk-sharp-list mailing list