2.057 down casts

Steve Teale steve.teale at britseyeview.com
Fri Dec 23 01:53:12 PST 2011


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?

Steve


More information about the Digitalmars-d mailing list