Why can we condition classes to platforms but not windows and Container controls ?
Again and again I find my self in need to having one Window for Mac and one for Windows. And often the Mac window cannot even be compiled for Windows so I end up with 2 solutions.
But the mechanism exists for classes to tick mark for what platform their compiled. So why not same for Windows and ContainerControls ?
Why ? Windows & containers arent JUST classes
Joe and I have looked at changing that so they are but it would likely break a pile of code
And you cant have two with the same name in a project anyway
So even if you have to create 2 windows you still need code to switch between which one you use at runtime or using a #if Target
We mostly use a single window with different containers embedded at runtime
The containers implement the same interface
The right one is determined using an #if Target and we’re off to the races
I would not need to name them the same since I can just have #if Target conditions in the code to launch them.
Yes I was going for the containers, but same with containers I cannot put the platform flags on them.
Though I just noticed that Xojo automatically excludes them if no code calls for them and does not make compile error even if they got Mac only control on them. I am going to experiment a bit with that maybe that holds.
If you’re going to use an #if Target to open the right window then you already have a solution
Design one for Mac and one for Windows and use the right one based on target
We do that in places as well
For others we embed different containers in windows based on target
The only key is that they implement the same interface so you can deal with them generically regardless of which one you actually get