Instantiate Controls at Runtime

I am trying to back port my app to older versions of RealBasic so I can support older versions of OSx. I have been successful for the most part but I have plugin controls that only work on certain version of Realbasic/xojo. I would like to #if #end around them but to do that I would need the ability to instantiate controls at runtime. Which you cant do currently.

I wanted to ask, why isn’t this in the language?

There is a feedback case for this <https://xojo.com/issue/2725>

Because the IDE/compiler writes a boatload of code for each control on your behalf. While is is theoretically possible, I believe the current design/implementation of the IDE/compiler makes it very difficult. But that’s just a third party observation with no actual knowledge of the internals.

Its definitely not the compiler.
IF you were going to do it at runtime you would have to write all the code manually to create the control, set initial values, hook up all the events and do everything else the IDE does for you automatically.
And do it “right” so doing this doesn’t break everything that IS already set up, mess with the view hierarchy, break menu handlers and lord knows what else.