Re: custom TreeModel



On 5/23/06, Tamer Mowafy <kalimakhus yahoo com> wrote:
Hi Jonathon

I have downloaded your tarball and gave it a trial.
First of all it does do the trick. It is way simpler
to inherit from your class than to inherit from
(implement) TreeModel directly.
I see that you got rid of the GlueItem used in the
Gtkmm example and I think this made your code clearer
and possibly more efficient.

ahh yes.  I did get rid of GlueItem stuff, but to do so I used quite
an ugly hack (storing the row number in a void pointer variable --
user_data).  I'm not what approach I want to use long-term, but I did
it this way for now just to get something working without too much
effort.

I experimented with removing the virtual inheritance,
and recompiled without related warnings. (would you
please post your compiler's output for the warnings
you mentioned).

actually, I believe most of the warnings I was talking about were
run-time warnings, not compiler warnings.  I hadn't really noticed any
compiler warnings -- maybe there were some and I missed them though.
I was able to compile just fine without virtual inheritance, but I
would get runtime warnings on the commandline when I ran the example
and it didn't populate the treeview.  Did it populate the treeview for
you when you didn't use virtual inheritance?

I get the following output and nothing shows up in the treeview:
--------------------
$ ./src/testcustomtreemodel
setting up Main
setting up win
Constructing vector container
Adding item 1
Adding item 2
Adding item 3
Adding item 4
Adding item 5
Creating custom treemodel

(testcustomtreemodel:1068): glibmm-CRITICAL **:
Glib::Interface::Interface(const Glib::Interface_Class&): assertion
`gobject_ != 0' failed
creating tree view

(testcustomtreemodel:1068): glibmm-WARNING **:
Glib::ConstructParams::ConstructParams(): invalid object type
`gtkmm__CustomObject_15SimpleTreeModel' for value type `GtkTreeModel'
Appending column
Adding treeview to window
Showing all
--------------------
Do you get those as well, or did it work for you?

I have built the example against (Gtkmm 2.6.4) (this
is the one that comes with my Linux distro), (not
2.8.0) . I can't be sure if this should make a
relative difference. Of course your configure script
complained about the wrong version of Gtkmm. I needed
to extract the sources away and compiled them using a
generic Makefile I use for gtkmm examples.

Yeah, I borrowed that configure script from another project and forgot
to reduce the required gtkmm version.  Sorry about that.  I don't
think I'm using any 2.8-specific API in this example.  I didn't do
anything special in the Makefile, so your generic Makefile should
probably be just fine.

Jonner



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