Under what circumstances does a DrawingArea know its parent?
That is, suppose you have code like this:
import gtk.DrawingArea;
class My_Class : DrawingArea {
this( ) {
super( );
// other stuff
}
void query( ) {
Widget parent = this.getParent( );
// do something with parent
}
}
auto my_object = new My_Class( .... );
Box b = get_from_glade_somehow( );
b.add(my_object);
containing_window.show( );
my_object.query( );
Would you expect the getParent( ) call to return something non-null?
The reason i'm asking is i'm trying to debug something, and it would be handy to take a look at the parent.
However, the parent from getParent( ) is showing up as null.
I think that might be ok, as this is what happens in Oldrich Smehlik's gPolynomial app (hosted on github) in his Plot class.
And in that case, i'll just force in a reference to the parent at construction time and use that.
But if the DrawingArea really should already have a pointer to its parent for whatever reason, i don't want to hack in a second copy so unnecessarily.
(As a secondary issue, it's a unclear to me whether i have to make a call to super() inside the constructor.)
TIA for any info or references (maybe this is mostly a gtk question rather than a gtkd question?).