Web lists-archives.com

Re: GtkTreeView disaster




Hi,

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

To have several types of rows in the treeview:

- define another column in the model (not in the treeview).

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

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

- define a modify function for the filter.

- 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

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

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

   - define the cell renderer as text or as markup.
   - play with several properties for column sizing and for wrapping.

Hope you get success, regards.

JLF

Sent from TypeMail

On Oct 14, 2015, at 07:36, ternaryd <ternaryd@xxxxxxxxx> wrote:
Hi,

Sorry for this long message, but I spend hours
trying to do this, and wanted to be sure to
have done my "homework". These three questions
are about a debian system with gtk+3 at version
3.16.6-1, the documentation I used mainly is
that on developer.gnome.org/gtk3/stable.

The initial idea was a tree of a depth of up to
5 levels, each node representing 2 or 3 aspects
of a hierarchical concept, where each node, no
matter what level, can have a longer
description (up to maybe 10 lines of text). I
thought the tree view to be specially
attractive, because it is possible navigate
nicely collapsing and expanding single items,
all set to be editable, including the
descriptions, feeding each change back to
sqlite3.

The first problem I couldn't solve was, when I
realized that I actually have two different
types of rows: the set of the 2 or 3 aspects
(adding at most some 100 to 150 characters
of text) would be one, the descriptive paragraph
the other. Is there any way to insert something
between rows?

As I couldn't find a solution for that,
I conformed thinking of a rather wide window
and limiting the width of that column, such
that the text would be displayed in more than
one line. This lead to the second problem, as I
couldn't find out how to have the top line of
that paragraph be aligned with the rest of the
row. Also, each additional line increased the
vertical separation between the rows. On a 27
inch monitor, a 10 line paragraph would insert
several screen pages full of white space.
Setting the row height explicitly to not
fixed wouldn't help. Then I found reports of
similar problems in Internet, but the solution,
setting property "yadj" or "yalign", would lead
to a program crash and didn't even promise to
solve the problem of the separation. What is the
correct way to do this?

When looking through the properties of
GtkTreeView, GtkTreeViewColumn and
GtkCellRenderer/Text, I also found the
properties "language" and "language-set", but
again, when setting these properties, the
program would crash. I must do something right
setting properties, as others (e.g. "editable")
would work just fine. As the text in fact can
be from different languages, I thought this
possibility interesting. How are they used
correctly?

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