Web lists-archives.com

Re: GtkTreeView disaster




On Wed, 14 Oct 2015 10:03:00 +0200
Juan Luis Freniche <fdesp87@xxxxxxxxx> wrote:

> I think the subjet of message' subject is
> pointing wrong.

My result using GtkTreeView certainly is a
disaster ;-)

> To have several types of rows in the treeview:
> 
> - define another column in the model (not in
> the treeview).

The descriptions are already in a column of
their own in the model. They can be empty, but
there are always there.

> - at model load time, just fill in this
> column with the type of row.

Maybe I didn't explain myself very well. The
model looks essentially like:

+ [code][abbrev][name][description]
  + [code][abbrev][name][description]
    + [code][abbrev][name][description]

In many cases, [description] is empty, but if
it is not, I'd like to display it folding the
last column into a second line, as in:

+ [code][abbrev][name]
  + [code][abbrev][name]
    text text text text text text text
    text text text text text text text
    text text text text text text text
    + [code][abbrev][name]
      text text text text text text text
      text text text text text text text
      text text text text text text text

The nice thing about tree views is, that I can
make all of it disappear just collapsing the
row. This allows me to keep a huge amount of
information in my frame of sight.

I haven't yet looked at Filters (which I will),
but just by the meaning of the word, I can not
imagine, how selecting a subset of rows (i.e.,
not displaying certain things) could help me
here.

> - now when defining the treeview, define
> first of all a filter on the model then the
> treeview on such filter.

OK.

> - define a modify function for the filter.

OK.

> - in the code of this modify function (which
> is called for every cell in every row using
> the filter, an iter to such filter and the
> column number) do:
>
>     - obtain the model and the model iter
>       from the filter and filter iter
>     - obtain the row type

In the model (filtered or not), all rows are of
the same type. It's in the view, the way should
be displayed where's the difference. See my
ASCII graphic above.

>     - make the necessary to set a value to
>       the cell.

What would be "the necessary" to have the last
column be drawn below the other columns?

> In the case of text, you can reformat the
> lines (for example using \n) or leave this job
> to the text cell renderer:

This I already have done, and it works fine, as
long as the description is not more than one
line high. If it is so long that the text is
wrapped, the interline spacing is still OK, but
now, the rows in the trees are extremely
separated: the more lines in the paragraph,
the further apart. If there are 10 lines of
text, I have to scroll over empty space for
several screen pages until seeing the next row,
but the paragraph itself is OK.

> Hope you get success, regards.

Gracias.
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list