Tips for building Cross Platform

My application is nearly complete. It’s a Windows 64 bit app. It uses no extra plugins. I’m at the point where I’m having thoughts of compiling for Linux and Mac too.

It’s perfect on Windows. On Linux, I have one tab where controls have gone mad. They overlap and do crazy stuff. it is a train wreck on Mac. It’s all of the sudden black background and form elements (container based, and on a tab panel) bleeding through.

Clearly I don’t know how to use the transparent settings! It’s seems Windows is way more forgiving in that respect, leading me to some bad choices. Also, controls in Linux and Mac can’t be spaced as closely as in Windows. Many of them clip each other.

Long story short. I’m seeking threads where this sort of discussion has occurred. I’ll be searching here, but if you have any pointers, I could use them.

Thanks, Bill

2018R4

To stop the black background issues on mac, you will need to go through all controls as a window opens and set their Transparency to True.

The sort of tips I need are when to use transparent, when not.

For example, on Window1, I have a TabPanel. On each tab of the tab panel I have a container. All of the controls are on the containers. Listboxes, labels, text fields and areas. Group boxes here and there. Where do you want and not want transparent?

Do I target that to just Mac?

Yup #if that puppy :slight_smile:

So is anything ultimately set as not transparent in this scenario? In other words, what ultimately controls the back color?
I would have a stack like Window/Tab Panel/Container/Various Controls

It would need a little testing as I’m not up to speed on macos but I know that causes the black background issue. Someone else might be able to chip in with a definitive list without having to pop every control onto a window to find out.

For Linux you might want to look at modGTK3. I wrote about it the other day at https://www.bkeeneybriefs.com/2019/02/modgtk3-for-xojo/

My other bit of advice is do the cross-platform testing earlier. Even if it’s just a sanity check. We do our development on the Mac side and generally we don’t have too many issues on the Mac (because we see it all the time) but Windows and Linux testing is definitely done occasionally just to make sure we’re not missing something big.

This is a MUST if you want consistency and proper cross platform operation.

Is modgtk3 supposed to affect groupboxes? I ask because I use several in my app, and found that they behave differently under macOS/Win/Linux.

To fix this I added a method to adjust height and top for groupboxes, and found that this worked quite well enough for Win7 (the method is a no-op for macOS, which is where I develop the app). This method is called in the open handler for each groupbox.

Now, for Linux, I was already using modGTK3, which fixes up most controls nicely, but I couldn’t get my new method to work OK under Linux until I realised that its effects were probably being overridden by modGTK3. I then added this:

if  (ctrl IsA GroupBox)  then Continue                  // TS: don't adjust groupboxes

after line 17 in GtkWidgetHeightFixCallback, after which the groupbox layout looks fine.

However, I feel reasonably certain that this is just a hack, and that there must be a way to do this which is consistent with the rest of the package. OTOH, why would groupboxes be included in this scheme anyway? They don’t have a minimum height. And does the same consideration apply to textareas?

You can verify the platform, and cycle through all the controls to turn transparent off.

Not sure I understand. Do you mean programmatically, in the IDE or manually?

Programmatically. If you mainly run on Windows and have transparency off on all your controls, set them to true at runtime as you open the window only on Mac using an #if

[code]#If TargetMacOS then

#endif[/code]

Then use the kind of code sample at http://documentation.xojo.com/api/deprecated/window.html#window-control to cycle through controls on the window, and if applicable, turn off Transparent.

[quote=425677:@Michel Bujardet][code]#If TargetMacOS then

#endif[/code]

Then use the kind of code sample at http://documentation.xojo.com/api/deprecated/window.html#window-control to cycle through controls on the window, and if applicable, turn off Transparent.[/quote]

Window.Control is exactly what I was hoping for! Thanks!

Thanks for the help Julian!