Issue Filed About Control Size Issues on Raspberry Pi

I’m seeing issues with the control sizes on my Pi 3, 4 and 5. Basically, the control is too small to fit all the text properly on Buttons and Labels. When I build for Windows, Mac or Linux it’s fine. The issue is only on my Raspberry Pi’s. Anyone seen this and hopefully have a fix?

Please see the following for the ongoing discussion and some screen shots.

https://tracker.xojo.com/xojoinc/xojo/-/issues/75215

From there:

MacOS render, and then on his Pi (with extra big letters):

Screenshot_2023-12-19_at_4.36.06_PM

Screenshot_2023-12-19_at_4.34.48_PM

His example uses system font, size 0. Basically Default.

Normalize Control Sizes set on.

Raspberry Pi OS (December 5th 2023, Debian 12, Bookworm)

Set the control font to 12 and it will fit the defaut size. I believe xojo soomehow doesn’t really set the correct size (system default is probably 12 but xojo defines 14).

I do subclass the controls and set
#if targetArm And TargetLinux then
Self.FontSize = 12
#endif
RaiseEvent Opening

// you need to define event Opening again

I just manually set 3 controls on my test code to FontSize = 12 and they display correctly. Obviously it does’t make sense to do this manually, and I’m not sure how subclass the controls. I’m assuming simple code put somewhere in the project will handle all the controls, but I don’t know what that is or where to put it. I did try cut and paste of your suggestion and it didn’t work. I’m sure I didn’t put it in the proper place or use correctly.

I guess the Normalize Control Sizes is defective in this OS + DE

2 Likes

You can create a defaults override with the controls that you want (if changing 0 to 12 doesn’t affect your Windows/Mac/Linux projects).

In Documents create a folder named Xojo, inside one that is called Overrides, then for example DesktopButton.defaults as text file with this inside:

FontSize=12

now when you add a DesktopButton to your project it will show 12:
image

instead of 0.


Right click the control that you want to subclass:
image

Then a new control will be on your project:
image

Add the Opening event and Add an Event definition called Opening:
image

Add the code to the opening event:

#if targetArm And TargetLinux then
  Self.FontSize = 12
#endif
RaiseEvent Opening

Now, instead of using the default control, use the subclassed control in your projects.

1 Like

This makes sense to me. Look at the text on this screen shot of the Remote Debugger window on the Raspberry Pi. Even their code displays the issue.

1 Like

i remember i used 4 mm font on raspberry pi, not point size.

Well that’s my solution. The most obvious solution would be to make a ticket report with this info.

Thanks for explaining albert, i didn’t had the time for this. This pinpoints how i solved it.

“This pinpoints how I worked around it.”

There’s only one “solve” possible, Xojo fixing the “Normalize Control Sizes” for this platform.

2 Likes

Hello,

There is a trick to make it work. Run the program with sudo.

On Raspberry Pi, running the program with the following command ignores global settings on Raspberry Pi:

./position

Running the program with sudo privileges allows some code, like window position, control size, etc. to work

sudo ./position

The problem with sudo, is that your program is granted administrative privileges and has total control over the computer. Programs running on the Raspberry Pi are now using virtual environments to protect the Raspberry Pi Operating System.

I have to compile the program on my Windows computer, and then copy the executables and libraries over to the Raspberry Pi to make sure the program runs, and is protected, the way that I want.

Hope this helps

Edit:
The proper way to run on a Raspberry Pi is to create a virtual environment, install dependencies, and run the program. Xojo doesn’t do this. The next time you want to run the program, restart the virtual environment, and run the Xojo program.

There are two options:

  1. recommended: create virtual environment, install dependencies, create Xojo program, copy binaries, start virtual environment, run Xojo binary.

  2. Unsecure method: Run Xojo binary with sudo.

The control is not too small, the text is too large!

Yes, your right, the text is too large. The control also has changed. It seems to have issues with the border around the control. Do both of these issues appear on the computer you are testing? Just curious :slight_smile: