ContainerControl Question

I have not done much with container controls… I the past i avoided then so that my code could be used on any edition of RB/RS… But now with Xojo that no longer applies. I know they are sort of a Window but not exactly…

While Windows have a MinWdth property, according to the docs ( http://documentation.xojo.com/index.php/ContainerControl ) ContainerControls do not, which makes sense in general as that is specific to a Window…

But I am writing a ContainerControl subclass where a minWidth property does make sense… so I added one… and then in autocomplete I see 2 MinWidth (as well as MinHeight, MaxHeight and MaxWidth) properties. So while those properties are not documented to exist for ContainerControls, apparently they do…

My question is this…

Do setting those properties have any effect on ContainerControls? Can I used the built in MinWidth property in my subclass in my code (which will define a min width for the container) without side effects, or do I need to create a property with a different name?

.Thanks,

  • Karen

MinWidth doesn’t make sense for ContainerControls. It appears in autocomplete, because ContainerControl inherits from Window (despite that the docs say it inherits from Object directly).

Except for how I intend to use it.

I knew that… What I want to know is if there would be any side effects for me using it for my own purposes.

  • Karen

Started a conversation about this an hour ago: Properties being non-virtual. I haven’t yet found a good solution for this issue.

For classes that are not control (or window) classes (say another framework class or 3rd party plugin class) the way to present only the API you want is through composition. That is creating a new class that has the one in question as a property . That way you can expose only the methods and properties (using computed properties) from the inner class instance that you want by creating them on the outer class and have then call though to the inner class instance. .

In any case I just want to know if using the existing MinWidth property of the container control might cause side effects because of it’s window heritage.

Karen, won’t you be using the MinWidth property in the same way you would expect it to function on a Window i.e. to set the minimum width of your container control? If so I wouldn’t expect there would be any nasty side effects. Have you tried implementing it on a container with nothing else on it to see what happens?