Windows VS ContainerControls

So it seems that the Window property of RectControl returns the ContainerControl that contains that control unless it’s the true window and that will mean it uses the encapsulating window.

Does this mean that if the TrueWindow property does not return the same value as the Window property then that property actually returns a ContainerControl? And if that’s the case, does that mean you can cast a window to a ContainerControl?


No. It’s the other way around.

That’s what I meant but that’s good to know. Out of interest, is it possible to have your own classes that can be casted to other classes without inheriting from them? Could you use operator_convert for example? Thanks

You can only CAST to something that the object IsA. Ie., something in the Super hierarchy. Operator_convert creates a new object and allows you to set its properties from the values in the original.

Fair enough. But it appears that the ContainerControl is not a subclass of a window and I am curious how that is possible? Just something that the framework allows because it’s built-in is more first guess? Thanks

The Container Control is an EmbeddedWindowControl. The name says it all.

IDE: ContainerControl is a subclass of Window.
Runtime: ContainerControl is mapped to or wrapped in an EmbeddedWindowControl (a subclass of Canvas).

Look at this thread in the old forum entry: Looping through Window.Control and ContainerControls