[Lazarus] Cross-platform project. Font sizes not the same....

Bo Berglund bo.berglund at gmail.com
Thu Aug 22 10:50:29 CEST 2019


On Tue, 20 Aug 2019 23:47:39 +0200, Bo Berglund via lazarus
<lazarus at 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



More information about the lazarus mailing list