Recent

Author Topic: MacOS vs Linux edit boxes  (Read 287 times)

ravkepar

  • New member
  • *
  • Posts: 9
MacOS vs Linux edit boxes
« on: November 29, 2025, 04:56:57 pm »
I've made a subtitle editor on MacOS and when I'm compiling the same code on my Linux computer (ubuntu studio), the result is that the edit boxes are bigger than the same ones on MacOS. The hard solution is to reposition each one of them (and the label in front of them), but this has to be done manually each time when I'm doing a new compile on Linux. Is there an easy work-around for this problem, so that the edit boxes (and probably other fields) look the same on the other operating system?

dsiders

  • Hero Member
  • *****
  • Posts: 1509
Re: MacOS vs Linux edit boxes
« Reply #1 on: November 29, 2025, 09:44:53 pm »
I've made a subtitle editor on MacOS and when I'm compiling the same code on my Linux computer (ubuntu studio), the result is that the edit boxes are bigger than the same ones on MacOS. The hard solution is to reposition each one of them (and the label in front of them), but this has to be done manually each time when I'm doing a new compile on Linux. Is there an easy work-around for this problem, so that the edit boxes (and probably other fields) look the same on the other operating system?


TEdit is just a wrapper around the native control for a platform. And those generally use themes. Other wrapper controls have the same issue. You can use custom-drawn controls - but they won't really look native for the platform. Or you can use Alignment, Anchors, BorderSpacing and/or ChildSizing to automatically position the affected controls.

https://wiki.lazarus.freepascal.org/GUI_design_guidelines
https://wiki.lazarus.freepascal.org/Example:_Anchors._How_to_reliably_align_dynamically_created_controls_under_changing_visibility
https://wiki.lazarus.freepascal.org/IDE_Window:_Anchor_Editor

CM630

  • Hero Member
  • *****
  • Posts: 1579
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: MacOS vs Linux edit boxes
« Reply #2 on: November 29, 2025, 10:09:28 pm »
Linux uses (mainly) two frameworks for their interfaces - GTK and KDE.
To make sure that your app looks readable, you have to adjust it for both.
AFAIK there are other options - use fpgui and/or msegui. I could not find out if they are alive and usable, here is a thread about that, maybe you can understand something better than me:
 https://forum.lazarus.freepascal.org/index.php/topic,69904.0.html
Even if they are usable, you will still have troubles - there is something wrong with font rendering in GTK - a text written with the same size of the same font is always wider in GTK. Even it was not so, in a multilanguage app you can never know how big a control needs to be.

So indeed, take a look at @dsiders's proposal. You are going nowhere without anchoring anyway.
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

 

TinyPortal © 2005-2018