Re: Can a treeview do this?



On Mon, 2006-02-27 at 16:29 +0100, Gus Koppel wrote:
kadil wrote:

I don't think a treeview can render this tree structured data that way I
wanted. The way I want it and the type of data is shown below:

 ________________________________________________________
|  Function | Funct Failure    |  Failure Mode           |
 --------------------------------------------------------
|to be able |slow leak         | worn washer             |
|control the|                  |-------------------------|
|rate of fl-|                  | damaged seat            |
|uid passing|------------------|-------------------------|
|thru the   |unable to control | seized                  |
|device     |flow at all       |-------------------------|
|           |                  | frozen                  |
|--------------------------------------------------------|

Any ideas, comments warmly received.

No, I don't think a GtkTreeview can display this sort of structure.

However, this sort of layout can perfectly be achieved by utilizing a
GtkTable (instead of GtkTreeview). The "Row Span" property of cell
widgets in a GtkTable is to be set here. It's the very same as in HTML 4
tables, for instance. By doing this you're also not limited to simple
drawn items like texts or bitmaps in the cells but can easily put any
widget into them, i.e. buttons. To get closest to the appearance you
sketched I suggest to use a GtkLabel in a GtkFrame for each cell.

Main drawback is that if you're about to use more than 50 rows like this
via a GtkTable, some performance degradation may start to take place.
But for structures with limited numbers of cells this is negligible.

Btw, GtkTable should be put into a GtkScrolledWindow, to handle the
situation when there are more rows (or columns) to be displayed than the
window dimensions allow - offer scrollbars in that case. It's the same
way original GtkTreeViews work.

I already created an example of your desired layout type but I'm afraid
its Glade XML or .c code is a bit too long to include here (~10 KB).
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Thanks Gus. I am looking at thousands of rows, so I might have to do
something a bit more complicated. Maybe mapping this data to a gtktable
dynamically to reduce the overheads.

Kim




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