On Sat, May 4, 2013 at 8:02 PM, yu wu <vanii.wa...@gmail.com> wrote:
> Since more than one column is changed, row-changed signal will be emitted
> more than once and widgets will be updated more than once. But I just want
> to update other widget once.

This is only more or less true.

When you receive "row-changed" multiple times, then you probably do
something like:

  o gtk_label_set_text()... which is not going to queue a redraw if
the new text is the same as the old text

  o If the text has changed, it will queue a redraw...

So even if a couple things actually changed on a couple different
widgets, that is all happening
synchronously, and then a redraw is queued, things only get painted
once with the new value.

Cheers,
       -Tristan

> This is why I want to know if it is possible to
> know which column is changed in other email. But from your reply to my other
> email, there is no way to know which column to change when row-changed is
> emitted. Then I have to update widgets when cell of column 0 is edited or in
> other functions which result in the change in column 1~3 mentioned above.
>
> As to GtkCellView, I have never used it. I have to read it first and then
> see.
>
>
> 2013/5/4 <tristan.van.ber...@gmail.com>
>
>>
>> On 2013-05-04, at 7:00 PM, yu wu <vanii.wa...@gmail.com> wrote:
>>
>> 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.
>>
>>
>> I see, well the most efficient way to handle your situation really depends
>> on what you need.
>>
>> For your other display widgets, you might consider using GtkCellView (a
>> widget for rendering a single row from a tree model), or like you mention in
>> the other mail, you could listen to "row-chaned" and update all the widgets
>> which need to display the changed row.
>>
>> You could also implement custom display widgets like GtkCellView, by
>> keeping a GtkTreeRowReference, queuing a redraw when the row changes, and
>> drawing the visual state based of the row data at "draw" time.
>>
>> 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?
>>
>>
>> Don't worry about it, posts can't be "moved", just use the other lists
>> next time ;)
>>
>>
>> 在 2013年5月4日星期六,Tristan Van Berkom 写道:
>>>
>>> On Sat, May 4, 2013 at 12:37 PM, yu wu <vanii.wa...@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
>>> >
>
>
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list

Reply via email to