Re: Two warnings when creating a TreeStore
- From: José Alburquerque <jaalburquerque cox net>
- To: Murray Cumming <murrayc murrayc com>
- Cc: paul linuxaudiosystems com, gtkmm-list gnome org
- Subject: Re: Two warnings when creating a TreeStore
- Date: Thu, 13 Sep 2007 11:15:18 -0400
Murray Cumming wrote:
On Wed, 2007-09-12 at 11:59 -0400, Jos�lburquerque wrote:
[snip]
When you say a
static instance, are you referring to one of my "Element" derived
classes or are you referring to the TreeModelColumnRecord class I've
defined (columns) which *is* static within my "DVDProject" class? Would
changing the "staticity" of this static member help?
Yes, that's the problem.
Thank you Paul, Murray and all who've replied to my questions. You've
all been really helpful. I just wanted to say that thanks to all your
replies I was able find that indeed the problem was the static member.
I made it an instance and every warning disappeared.
In a way, Paul was right in that there was something going wrong because
something global was being "instantiated" before the initialization of
gtkmm and Murray put his finger right on the problem by pointing out
that I had a static member that should be an instance.
On another note, can I pick your brain a bit more and ask you a little
about how gtkmm handles inheritance? As I had mentioned, all the
objects I work with are derived from a base class (which I call
"Element") with a virtual method called "getName()" designed to return a
string naming the object I'm dealing with (so I can "render" the string
in the TreeView). I've overridden the method in various derived
classes, but in a rendering method (which I set up with the
TreeView::Column::set_cell_data_func()) when I call the object's
"getName()" method, it's overridden method is not called, but instead
the base class method is called. Am I missing something? If it helps
the short TreeView initialization and the rendering method I use
follows. I'd really appreciate any insights. Thanks for your comments.
[snip]
gtkmm doesn't change anything about how C++ does inheritance.
You should maybe check that your instance is really an instance of the
class that you expect.
As far as gtkmm and inheritance, I found that if I use something like
TreeModelColumn<MyBaseClass> in a TreeModelColumnRecord, derived members
of MyBaseClass only use the virtual methods of the base class (not the
derived class!), but if I use something like
TreeModelColumn<MyBaseClass*>, dereferencing the pointer to the derived
class later, does use the virtual (overridden) method of the derived
class. Thanks again everyone for your help.
-Jose
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]