Re: event propagation on GtkCellEditables



On Wed, 2004-04-14 at 23:26, Lorenzo Gil Sanchez wrote:

> So far this works pretty well for the GtkTreeView, but for the GtkGrid
> I'm writting there is the following problem: When the user press the Up
> (or Down) key it should move to the up row same column but I can't do it
> since the key_press_event is not propagated to the grid. This event is
> not propagated because in the gtk_cell_editable_key_press_event if the
> key is the Up key then it returns TRUE (meaning that it has handle the
> event and no further process is required).

I ran into the same problem trying to add that very same feature to a
todo list application[1].  I ended up subclassing GtkCellRendererText
and overwriting the start_editing vfunc: Instead of creating a new,
private GtkEntry for every call to start_editing, I create one
persistent widget (GtkTextView in my case) in init_instance and put that
into an object property ("editable-widget" in my case).

The code using that renderer can then use g_object_get to retrieve the
widget and connect signal handlers to it.

That's no real solution because it introduces needless overhead (well,
at least for me, since I'm doing all that in Perl, where this approach
causes a lot of unnecessary marshalling).  I think GtkCellRendererText
should either implement the above approach or, as Owen once suggested,
introduce a new signal like "editing-started" which provides you with
the GtkEntry used.

HTH,
-Torsten

[1] http://home.arcor.de/kaffeetisch/odot.html




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]