[Lazarus] Too large height of TEdit and TSpinEdit in xfce

Bo Berglund bo.berglund at gmail.com
Mon Sep 16 08:19:40 CEST 2019


On Mon, 16 Sep 2019 00:29:58 +0000 (UTC), Haruyuki Fujimaki via
lazarus <lazarus at lists.lazarus-ide.org> wrote:

>Hello everyone,
>I am maintaining my softwares in xfce desktop system (Linux Lite).
>The height of TEdit and TSpinEdit controls becomes awkwardly too 
>large as shown in attached screenshot.
>By setting AutoSize := False, I can modify the height, but it is 
>laborious for a big project and downward arrow of TSpinEdit is 
>hidden.Does anyone know how to solve this problem?
>Haruyuki Fujimaki

I recently had a similar problem with a cross-platform application
when I built it on Linux (Raspbian).
In my case the controls became too small, but I think the problem is
the same as yours.

My sources are first developed on Windows and stored in subversion.
When I retrieved them in Raspbian and opened Lazarus there to build
the Linux version the user entry boxes for data were all too small.

What happened was that the font of these controls had gotten a
different size when the project was opened in Lazarus on Linux!

In my case the control types affected were buttons, spinedits,
statictexts, groupboxes, checkboxes and labels.

So I had to add a procedure to set the font size of them all, which is
called from the Form.OnShow event. I only had to change the size by
one point to make the form look OK again.

Here is my function:

procedure TfrmMain.SetFontSize(S: shortint);
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;
  lblTotal.Font.Size := S;
end;


And it is called from here:

procedure TfrmMain.FormShow(Sender: TObject);
begin
  SetFontSize(9);
end;

I do not understand why the size clearly stated in the sources as 9
are changed by Lazarus when the project loads on a different operating
system, but that is in any case what happens.

I am using Lazarus 2.0.4 and fpc 3.0.4 on Windows and Raspbian.


-- 
Bo Berglund
Developer in Sweden



More information about the lazarus mailing list