Tips for building Cross Platform

  1. 9 months ago

    Bill S

    5 Feb 2019 Pre-Release Testers, Xojo Pro
    Edited 9 months ago

    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

    #If TargetMacOS then
    
    #endif

    Then use the kind of code sample at http://docs.xojo.com/Window.Control to cycle through controls on the window, and if applicable, turn off Transparent.

  2. Julian S

    5 Feb 2019 Pre-Release Testers, Xojo Pro UK

    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.

  3. Bill S

    5 Feb 2019 Pre-Release Testers, Xojo Pro

    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?

  4. Bill S

    5 Feb 2019 Pre-Release Testers, Xojo Pro

    @Julian S 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.

    Do I target that to just Mac?

  5. Julian S

    5 Feb 2019 Pre-Release Testers, Xojo Pro UK

    Yup #if that puppy :)

  6. Bill S

    5 Feb 2019 Pre-Release Testers, Xojo Pro

    @Julian S Yup #if that puppy :)

    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

  7. Julian S

    5 Feb 2019 Pre-Release Testers, Xojo Pro UK
    Edited 9 months ago

    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.

  8. Bob K

    5 Feb 2019 Pre-Release Testers, Xojo Pro, Third Party Store Kansas City

    @Bill S On Linux, I have one tab where controls have gone mad. They overlap and do crazy stuff.

    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/

  9. Bob K

    5 Feb 2019 Pre-Release Testers, Xojo Pro, Third Party Store Kansas City

    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.

  10. 8 months ago

    Tim J

    6 Feb 2019 Pre-Release Testers Dehydrating in AZ

    @Bob K 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/

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

  11. Tim S

    20 Feb 2019 Canterbury, UK

    @Tim J 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?

  12. Michel B

    20 Feb 2019 Pre-Release Testers, Xojo Pro RubberViews.com

    @Bill S Do I target that to just Mac?

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

  13. Bill S

    20 Feb 2019 Pre-Release Testers, Xojo Pro

    @Michel B 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?

  14. Julian S

    20 Feb 2019 Pre-Release Testers, Xojo Pro UK
    Edited 8 months ago

    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

  15. Michel B

    21 Feb 2019 Pre-Release Testers, Xojo Pro Answer RubberViews.com
    #If TargetMacOS then
    
    #endif

    Then use the kind of code sample at http://docs.xojo.com/Window.Control to cycle through controls on the window, and if applicable, turn off Transparent.

  16. Bill S

    21 Feb 2019 Pre-Release Testers, Xojo Pro

    @Michel B #If TargetMacOS then #endif

    Then use the kind of code sample at http://docs.xojo.com/Window.Control to cycle through controls on the window, and if applicable, turn off Transparent.

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

  17. Bill S

    21 Feb 2019 Pre-Release Testers, Xojo Pro

    @Julian S 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

    Thanks for the help Julian!

or Sign Up to reply!