I’m working on a layout mechanism and I have run into a situation where I can’t use my main function to get the position and size information from a ContainerControl. Here is my method signature:
GetControlInfo(theControl As RectControl) As arrSizePosition()
This is no issue if the Control passed is any other control, and I get back my array with the top, left, width, height values). When I pass a container, I get the error:
Parameter "theControl" expects class RectControl, but this is class ccBackupJobs.ccBackupJobs.
Is it possible to work around this so that I can deal with all of my ContainerControl-based custom controls?
Oh EmbeddedWindowControl would have been nice to know about a couple weeks ago Is it documented anywhere?
I ended up taking an overloaded approach that had a signature for RectControl and one for ContainerControl.
EmbeddedWindowControl can be used in place of both RectControl and ContainerControl I think. Nope.
I believe what Jason is offering is these choices:
GetControlInfo(theControl As RectControl) As arrSizePosition()
GetControlInfo(theControl As ContainerControl) As arrSizePosition()
GetControlInfo(theControl As EmbeddedWindowControl) As arrSizePosition()
That’s how I understood it (have not had the opportunity to test)
The documentation is at least clear that ContainerControl is not a child of RectControl. They are both children of Object, but I like scoping it to EmbeddedWindowControl if that ends up working out.
I don’t believe it is documented. It is a hack (my opinion) related to the fact that the Control() function returns an array of RectControls, but a ContainerControl is derived from Window, not Control. Therefore, you cannot have a ContainerControl in the Control() array directly, so they had to have a place holder of some kind to represent the ContainerControl in the list of controls on the window. By itself, the EmbeddedWindowControl isn’t very useful, so you end up maintaining your own array of ContainerControls that you can manipulate as needed.