Re: gtktreeview: Data for all columns is retrieved although only a small subset of 1% is visible - Why?

On 15 Dec 2015, at 23:04, Friedrich Beckmann <friedrich beckmann gmx de> wrote:

/* we *need* to set cell data on all cells before the call
 * to _has_can_focus_cell, else _has_can_focus_cell() does not
 * return a correct value.


I am not sure, but I maybe this is the reason that in our case
the data for 2000 columns is retrieved, although only 16 are visible.

Do you mean visible as in “gtk_tree_view_column_get_visible(column) == TRUE” or “the column is visible on the 
screen” ? This is an important difference.

Does anybody
remember the reason for this full retrieval? Is this a fundamental problem which
can not be avoided?

(If I remember correctly) it needs to verify whether any column that is visible (as in get_visible() == TRUE) 
has a “can-focus” cell. If no column has such a cell, the keyboard interaction model changes slightly: a 
cursor rectangle will be drawn that encompasses all columns. This check is performed in 
gtk_tree_view_has_can_focus_cell() which is called at line 5119.

Because the “can-focus” cell property can be changed dynamically through set_cell_data, it is close to 
impossible to cache this properly. This is typically not a problem, since we deal with < 20 columns. 
GtkTreeView was simply not designed for dealing with hundreds of columns.

Note that gtk_tree_view_has_can_focus_cell() skips columns with get_visible() == FALSE, so I *think* (but am 
really not sure) that get_visible() == FALSE columns can be skipped in the set_cell_data_func loop. However 
if in your case all columns are get_visible() == TRUE, this won’t help you. In that case, you probably want 
to have some function to set a has_can_focus_cell() “hint” which overrides and removes the need for the 
dynamic check.



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