www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - 2.057 down casts

gtkD has a ColorSelectionDialog class with a method that returns an 
associated ColorSelection class as a Widget. In COMPO I used to cast this 
to a ColorSelection, then I could set the initial color and retrieve the 
user's choice.

The inheritance sequence is:

Widget -> Container -> Box -> VBox -> ColorSelection
       OrientableIF ->

that is, Box is derived from Container and OrientableIF.

I've tried a chain of casts, but just the first one

Widget w = dialog.getColorSelection();
gtk.Container.Container ctr = cast(gtk.Container.Container) w;

gets null.

There's a Container class in the application also, but I have qualified 
all references to Container in the module.

Is there a way to force the older cast behavior?

Dec 23 2011