Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2019-09

Too large height of TEdit and TSpinEdit in xfce

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Haruyuki Fujimaki

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190916/cb347b0a/attachment.html> -------------- next part --------------
A non-text attachment was scrubbed...
Name: Too_large_heght_in_xfce.png
Type: image/png
Size: 6392 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190916/cb347b0a/attachment.png>

Reply by email

Bo Berglund
to Haruyuki Fujimaki
Haruyuki Fujimaki wrote 8 lines
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

Reply by email

Salvatore Coppola
to Bo Berglund

Ok it is a workaround but why not call your function only one time at start for instance in main form create? Regard
Salvatore

Il giorno 16 Set 2019, 08:20, alle ore 08:20, Bo Berglund via lazarus ha scritto:

Show quoted text 83 lines
On Mon, 16 Sep 2019 00:29:58 +0000 (UTC), Haruyuki Fujimaki via lazarus 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 -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20190916/7e4b4b2a/attachment.html>

Reply by email

Bo Berglund
to Salvatore Coppola
Salvatore Coppola wrote
Ok it is a workaround but why not call your function only one time at start for instance in main form create?

Yes, a typical workaround...
I am so used to using OnShow since my form always is only shown once and never hidden afterwards. But you are right that it should rather be in OnCreate!

Bo Berglund Developer in Sweden

Reply by email