Dynamic creation of controls using declares

Using MacOSLib or declares it is possible to create NSPopovers which contain controls from a Xojo window or container control which has been embedded in a window. From what I understand, doing this breaks the Xojo view hierarchy because controls are not necessarily placed where the framework expects them. I believe I can get around this problem using declares to create NSControls at runtime. Using declares controls can be dynamically created and added as subviews into the popover’s content view or any window’s content view, with methods called by the controls in response to user actions using delegates or AddHandler. I believe this method of adding controls to a popover’s content view should be acceptable to the Xojo framework but I am unsure is there could be any issues using this method or whether it is still likely to break something in the framework. A sample project which demonstrates the use of declares to dynamically create a button on an NSPopover is available here.

Yeah, putting your own view created via declares in your own popover created via declares is perfectly okay.

Ok great. And the same is not true for adding controls to the window view via declares I’m guessing?

On windows its possible you need the window handle to place the controls. On mac, I haven’t tried but im sure its similar?

I know how to add them, I just want to make sure I won’t be messing anything up by doing so.