Forcing layout

I am developing an application for the pi with a small touchscreen 1024x600 pixels. I’ve made the main window of the application not resizable, locked all of the controls and set the width and height of the windows to 1024 and 600 respectively. Even with these parameters the layout of the application on the PI gets messed up: buttons are too small, the main window doesn’t fit the screen, etc. On OSX, where I debug the application, it runs fine.

How can I force the layout of components on the screen when I have PI as the target OS?

Standard control sizes on most Linux systems differ from macOS. Either install a Linux system on a virtual machine and develop from there or maybe some other here (I think Michel has a good overview, if I don’t err) can help you getting the controls to the right sizes. Or, of course, use the new remote debugger for a quick preview and change the sizes on your Mac layout (even if it will not look good there) until they match your desired layout.

If you want to use both layouts, macOS and Pi, there’s the #pragma Target commands that can help you to switch to the correct sizes automatically. You could subclass a button for example and use its open event like

#If TargetLinux me.height = 28 // or whatever #Endif
and then use the custom subclass instead of the pure pushbutton.

[quote=323512:@Ulrich Bogun]If you want to use both layouts, macOS and Pi, there’s the #pragma Target commands that can help you to switch to the correct sizes automatically. You could subclass a button for example and use its open event like

#If TargetLinux
me.height = 28 // or whatever
#Endif
and then use the custom subclass instead of the pure pushbutton.[/quote]
This is my solution for all of my apps. My PushButton, PopupMenu, TextField, TextArea, ComboBox, and ListBox controls are all subclassed and both control sizes and text sizes are adjusted depending on the platform in a #if TargetXXXXX block in the Open event.