I *highly* recommend to avoid changing font sizes, users select themes
because they want applications to use them, so it is better to stick
with their choices and use autosizing (the default setting for most
controls), the align property and the anchor editor.

Here is an old (but still valid) video i made ~6 years ago where i
quickly show the anchor editor in practice:
https://www.youtube.com/watch?v=neigk9Pt21o

Using the anchor editor you can create UIs that dynamically adjust
position and size based on the user settings and allow the user to
resize windows.

Generally speaking try to design UIs that use as little fixed
positioning as possible. Fixed positioning (that is, dragging and
dropping a control on the form and manually adjusting its position and
size there with the mouse) is fine for simple applications that will
only work on Windows or macOS that traditionally has kept font sizes
the same over the years (though even then on Windows you can use
different fonts and some people do), but on Linux you simply cannot
rely on anything to be constant and fixed positioning can only be used
as a starting point for your layout (ie. place the controls manually
in a fixed position+size and then open the anchor editor and start
stitching them together one by one - this is basically what i do in
the video above).

Kostas

On Thu, Aug 22, 2019 at 10:50 AM Bo Berglund via lazarus
<lazarus@lists.lazarus-ide.org> wrote:
>
> On Tue, 20 Aug 2019 23:47:39 +0200, Bo Berglund via lazarus
> <lazarus@lists.lazarus-ide.org> wrote:
>
> >I can go into the font property of affected controls and change the
> >font size to make it look better, but there are so many...
>
> In fact there are not that many controls so I tried to do the
> following on Windows:
>
> procedure TfrmMain.SetFontSize(S: integer);
> begin
>   // Set font size on load.
>   btnDec60.Font.Size := S;
>   btnDec30.Font.Size := S;
>   btnDec10.Font.Size := S;
>   btnDec1.Font.Size := S;
>   btnInc1.Font.Size := S;
>   btnInc10.Font.Size := S;
>   btnInc30.Font.Size := S;
>   btnInc60.Font.Size := S;
>   btnCutStart.Font.Size := S;
>   btnCutEnd.Font.Size := S;
>   btnAddCut.Font.Size := S;
>   btnJump.Font.Size := S;
>   btnShiftAudio.Font.Size := S;
>   speDelay.Font.Size := S;
>   stxCutStart.Font.Size := S;
>   stxCutEnd.Font.Size := S;
>   stxCutTime.Font.Size := S;
>   stxClipCnt.Font.Size := S;
>   gbxCut.Font.Size := S;
>   ckbLogin.Font.Size := S;
> end;
>
> procedure TfrmMain.FormShow(Sender: TObject);
> begin
>   SetFontSize(9);
> end;
>
> This  works just fine on Windows so I went to my RPi4 and opened the
> project there and added these two procedures also to that instance of
> the project, thinking it would at laset fix the font size temporarily.
> But when I run this I get an exception!
>
> ---------------------------------------------------------------------
> Debugger Exception Notification
> Project VideoPlayer raised exception class 'EReadError' with message:
> Invalid value for property
> At address C4920
>
> [] Ignore this exception type     [Break] [Continue]
> ---------------------------------------------------------------------
>
> If I check the Ignore checkbox and contine I get another error:
>
> ---------------------------------------------------------
> Error reading frmMain.OnShow: Invalid value for property
> Press OK to ignore and risk data corruption
> Press Abort to kill the program
>        [Abort]  [OK]
> ---------------------------------------------------------
>
> Strangely it did not manage to handle the integer value for font size
> so I redefined the SetFontSize procedure to be declared as follows:
>
> procedure TfrmMain.SetFontSize(S: shortint);
>
> With this in place the form in Linux became the same as on Windows
> size-wise regarding texts.
>
> Maybe a difference between the operating systems, I think Raspbian is
> still a 32 bit system whereas Lazarus on Window 7 x64 is a 64 bit
> program on a 64 bit OS.
>
> --
> Bo Berglund
> Developer in Sweden
>
> --
> _______________________________________________
> lazarus mailing list
> lazarus@lists.lazarus-ide.org
> https://lists.lazarus-ide.org/listinfo/lazarus
-- 
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to