Re: capture "changed" signal for the cell of treeview



On Sat, May 4, 2013 at 12:37 PM, yu wu <vanii warem gmail com> wrote:
I am using the followed to renderer text in cells:

++++++++++++++++++++++++

  renderer = gtk_cell_renderer_text_new();
  column = gtk_tree_view_column_new_with_attributes((local = char_to_utf8
("weight(kg/m)")), renderer, "text", MEM_SEC_WEIGHT_PER_METER, NULL);
  g_free(local);
  gtk_tree_view_append_column(treeview, column);

++++++++++++++++++++++++

I don't set `editable' attribute for the renderer. The value for specified
cell is set by

other sub-function. Then how can I get the `changed' signal for the
specified cell when its
value is changed? My purpose is to update other widget when text value in
cell is changed.
For the text cell renderer, it only has edited signal that is not useful for
my case

How come the "edited" signal is not useful ?

You want to catch *every* change while the user is editing a cell ?

This can be done, but it kind of changes the way cell editing usually
works, i.e. pressing escape, or losing editor focus while editing a text
cell is generally supposed to "cancel" the current edit, hence usually
you wait until the "edited" signal is fired in order to commit any changes
to the underlying model.

If you need to handle every keystroke, then connect to the "editing-started"
signal of a GtkCellRendererText for example, the GtkCellEditable widget will
in this case be a GtkEntry (which will exist for the duration of the edit), then
you can connect to the "changed" signal of this entry.

Note also, this list is about development of GTK+ itself, you should direct
your questions about using GTK+ to gtk-app-devel-list instead.

Cheers,
       -Tristan

(or maybe I misunderstand some points). When some cell is changed, it might
have no
any selection. That's, the `changed' signal for selection has no use here.

Please help.

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list



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