In code, we can easily wrap a platform specific code around a pragma. How about a control? Can we have, for example, WindowA for windows and WindowB for linux? So, when compiling to windows, WindowB is not included into files list to be compiled.
It’s a frequent question, but no, you can’t have platform specific controls.
Wow, that’s make us need to maintain two identical projects.
Just wrap all your code inside pragma ifs to avoid declare conflicts and call the window you need in a similar manner.
It’s a little cumbersome, but it’s better than two projects.
File a feature request if you would like to see a change!
it’s not a code. it’s a control that currently support 1 OS only and will be replaced by xojo control when compiling to other OS.
oh, i think i can make adaptor to handle both control.
What i did is two different window/ container control for the different platform and called the appropriate one and use the #if target thingy
You could also put the platform specific control on a container and use EmbedWithin to add the control dynamically at runtime. As long as the exposed interface of the containers was the same it should be relatively transparent.
Confirmed, both solutions are working.
Thank you Richard and Greg.
I can’t find the feedback case, but I think there was a feature request to have per control or per project item checkboxes for the targets.
I suspect you mean this one
It has many issues that make it a low likelihood it will occur
Well, this describes it more or less.
The idea would be that you have checkboxes one each item, so when you assemble stuff to send to compiler, you can skip the ones without a checkbox for the current platform.
Oh I’m not worried about the compiler
The IDE would have to have some “esp module” to know what to display as you designed your layout since I’d imagine you might have 3 instances of “myCoolButton” and each one is different for Windows , Linux & macOS
But at design time there’s no way to indicate that you are laying out one for Windows , Linux or macOS
This isn’t a new request
Its why I said
[quote=347779:@Norman Palardy]It has many issues that make it a low likelihood it will occur
ESPecially since the three Buttons for Windows, macOS, Linux (such as in the MenuBar-Editor are already there - and might be all that’s needed.
Well, in MBS Plugin we have Cocoa based controls which only work on Mac.
If I build a Windows version, I’d love to leave it away and not include the plugin in the app.
Not even close
The menu bar editor we draw everything from scratch because its really simple to mimic
And you’ll note that it retains all the items - not conditionally shows and hides some.
It has minimal logic to reorganize them so things like Preferences show in the right place.
For the layout editor we ask the OS to draw everything - cant draw Windows or Linux controls on macOS, or macOS controls on Windows or Linux
Just getting the layout editor to draw in different OS renditions is a huge undertaking since we’d have to clone all the graphics for some version of Windows, some Linux UI and macOS to have them in the IDE available so we could switch the appearance - which I suspect violates a ton of copyrights