Re: custom TreeModel



hi,

on one hand I genuinely feel that there is a real use case for this: imagine a library that you've written, and you want to show its results in a gtk treeview, but straight from your result data structure and not by duplicating the nodes in the treeview itself. What if the input-output schema of your library is fixed? or suppose that you're porting it to gtk as an alternative to another gui? People will struggle with linking their library to the gtk treeview; or in any case I certainly had a hard time finding out how to get this working. Yes, this way of adressing the data certainly is complicated, but that makes an example all the more welcome, no? There is no way around this kind of custom code, if you want to avoid duplicating your data, or if your data is constantly changing, for instance.

I also tend to get lost in the documentation for gtk(mm), and for instance I just did not notice the examples in gtkmm-documentation/examples/book/custom/custom_treemodel . So an additional example in the gtkmm/demos does not look superfluous to me.

On the other hand, I don't want to impose, and if you feel there is no place for my example in the gtkmm demos, then so be it. People really desperate for an example will now find it in the mailinglist at "Date: Mon, 16 Dec 2019 23:10:45 +0100", I guess...

happy new year, 
Danny.

-----Original Message-----

Date: Mon, 23 Dec 2019 13:23:20 +0100
Subject: Re: custom TreeModel
Cc: gtkmm-list gnome org
To: danny <danny van elsen skynet be>
From: Kjell Ahlstedt <kjellahlstedt gmail com>

An alternative would be to add this in a new gtkmm-documentation/examples/book/custom/custom_treemodel directory in the gtkmm tutorial. And a description in a new section in the Custom Widgets chapter (which should then be renamed).

Isn't this kind of custom class that implements one or more interfaces quite unusual? And a bit more complicated than most of the demos? There is no corresponding program in gtk/demos. All existing C++ demos in gtkmm correspond to C demos in gtk.

Kjell

On 2019-12-22 11:06, danny via gtkmm-list wrote:
hello gtkmm,

so how do I continue with this? I feel that it would be really handy to add an example such as the one below to the gtkmm demos subdir.

I was struggling with this myself some years ago for a gtk2 program where the data were already established (and constantly changing) outside the gui in a separate structure.

Copying the data into the treeview model, as the existing demo programs do, is obviously not the ideal solution.

the other example in gtkmm-documentation keeps is very helpful, but it does not show subdirs...

regards, Danny.

On Mon, Dec 16, 2019 at 2:10 PM danny via gtkmm-list <gtkmm-list gnome org> wrote:
hi

well, actually, I did not find the example you are referring to. I probably did when I was working with the original gtk2 program, though.

so I have come up with this:
(gtkmm-3.22.3/demos)

--------------------------------------------------------------
/* Tree View/Tree Store
 *
 * The GtkTreeStore is used to store data in tree form, to be
 * used later on by a GtkTreeView to display it. This demo builds
 * a simple list of nodes in memory and displays it in the GtkTreeStore. 
 *
 */

...
--------------------------------------------------------------

I'm not sure, though, if I really understand the purpose of
virtual bool Gtk::TreeModel::iter_parent_vfunc (

this function finds a parent for the given child, right? but why would that be needed, if a child can only be arrived at from a parent node in the first place?

regards, Danny.



_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


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