Re: g_signal_emit()
- From: dhk <dhkuhl optonline net>
- To: Kristian Rietveld <kris gtk org>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: g_signal_emit()
- Date: Mon, 01 Sep 2008 17:18:25 +0000
dhk wrote:
Kristian Rietveld wrote:
On Sun, Aug 31, 2008 at 2:08 PM, dhk <dhkuhl optonline net> wrote:
I have two callback functions. The first for when a cell in a treeview
gets edited and the second for when the tab key is pressed. The
first works
fine. In the second, I want to emit the "edited" signal so it acts
as if
the first event happened. However, the g_signal_emit() in the
"key-press-event" callback does not seem to work.
I am doing the following and the renderer and sig_id are valid.
sig_id=g_signal_lookup("edited", G_OBJECT_TYPE(renderer));
g_signal_emit(renderer, sig_id, 0);
It looks like you are trying to emit the edited signal here without
specifying the correct arguments.
In short what I'm trying to do is emit the "edited" event when the
"key-press-event" occurs. That way when the use tabs off the cell in
the
treeview the callback for the "edited" event is called. It doesn't make
sense the if there are two way to leave a cell (tabbing off it or
clicking
outside of it) that you can't call the same event.
Maybe you can try using gtk_cell_editable_editing_done() here? The
editing-done signal handler of the respective cell editable will take
care of emitting the edited signal. You can get hold of the correct
cell editable by listening for the editing-started signal on the cell
renderer.
regards,
-kris.
That sounds like it could work. I'll see if I can get the
GtkCellEditable from gtk_cell_renderer_start_editing(). That seems to
take a lot of parameter that I don't have. I'll let you know what happens.
Thanks,
dave
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Kris, that was a great idea. The tricky part was getting the
GtkCellEditable pointer without doing a lot of work. Doing a lot of
work usually means I'm doing something wrong. After looking at the gtk
source, I was able to come up with the following four lines. It will
emit the "edited" signal from a "key-press-event" callback.
gtk_tree_view_get_cursor(GTK_TREE_VIEW(treeview), &tp, &focus_column);
if(focus_column!=NULL) {
gtk_cell_editable_editing_done(focus_column->editable_widget);
}
Thanks,
dave
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]