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



As I wrote in my original email, the renderer is ** not ** set editable. Therefore, it can't be connected to ** edited ** signal. 

Here is the situation for example. Renderer 1 -- column 0 is set editable. Renderer 2-4, i.e., column 1-3, is not set editable. When column 0 is edited, the value of column 1 is set. As to the values for column 2-3, they are set by other functions. Then I would like to capture the changes of column 1-3. After I get the changes, some other widgets (inside treeview or outside treeview) will be updated. 

By the way, I don't know the difference between gtk-list and gtk-devel-list. Now I know it. Could you or someone tell me how to move this post to gtk-list?

在 2013年5月4日星期六,Tristan Van Berkom 写道:
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]