Recent

Author Topic: TButton and TListBox fonts  (Read 1916 times)

certsoftor

  • New member
  • *
  • Posts: 8
TButton and TListBox fonts
« on: August 19, 2019, 12:56:10 am »
For years now I've been using Lazarus 1.4.4 on Yosemite. I recently installed 2.0.4 on a Mojave system because of the impending dropping of 32bit apps in the near future by OSX. I rebuilt the IDE for 64bit Cocoa and that seemed to go well.

I'm updating an application (re-configured for 64bit and Cocoa) and I noticed that TButton and TListBox controls ignored the Font and ParentFont properties and just displayed whatever font they wanted to (I have no idea what it is, but it is larger than the room available). I noticed that a couple of buttons were defined as TBitBtn (even though they didn't have a glyph) and those did follow the programmed font (TParentFont was TRUE). It was easy enough to change any TButton controls to TBitBtn to fix that problem (although I don't why I should need to).

Still no solution for the TListBox, no matter what I try it just displays whatever font it wants to. Its function is to display program generated messages and allow copying text to clipboard. Is there any other control (with working font capability) that I can use instead?

Thanks.

certsoftor

  • New member
  • *
  • Posts: 8
Re: TButton and TListBox fonts
« Reply #1 on: August 21, 2019, 12:56:18 am »
Just did a test to make sure the problem wasn't caused by something in the old project.

Built a new project with a TBitBtn, TButton, TLabel, and TListBox. All have ParentFont set TRUE.

TBitBtn and TLabel work as expected, both at design-time and run-time.

TButton works only at design-time, uses some other font at run-time.

TListBox doesn't work at either design-time or run-time, it just stays the same font regardless of the font the parent (The main form for this test).

I vaguely trying a newer (newer than 1.4.4) version of Lazarus maybe a year ago, wasn't trying to do 32-bit or Cocoa at that point, but running into the same problem.

I'm trying to figure why fonts worked on these controls back in 1.4.4 but newer versions don't. 

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: TButton and TListBox fonts
« Reply #2 on: August 21, 2019, 02:44:36 am »
I have a multi-platform (FreeBSD/macOS/Ubuntu/Win32)  application and have not suffered from font issues like you describe.  The $64K question: Why?

Maybe because I set the controls to "autosize" and leave the fonts at the default, my only changes are to the font style (eg bold).

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: TButton and TListBox fonts
« Reply #3 on: August 21, 2019, 04:48:00 pm »
I'm updating an application (re-configured for 64bit and Cocoa) and I noticed that TButton and TListBox controls ignored the Font and ParentFont properties and just displayed whatever font they wanted to (I have no idea what it is, but it is larger than the room available).
Most of the system driven controls would ignore TFont customization - and would use the system default font.
Feel free to bug report it! (so it's not forgotten).

The reason for that is lack of attention for the feature.
It's technically possible to customize a font on a control, but it's rarely used. (and is not really welcomed by Apple).

certsoftor

  • New member
  • *
  • Posts: 8
Re: TButton and TListBox fonts
« Reply #4 on: August 27, 2019, 11:26:55 pm »
When I got back to the project I ended up moving some controls around so I could make the listbox wider to handle the default font. It's a one-of-a-kind application for installation of a seismometer, we normally don't provide Mac apps, but since so many of those seismic guys use Mac laptops I thought I would give it a try.

I know I have a number of internal Lazarus Mac apps for accounting that do use a fixed-point font for listboxes so everything lines up correctly. I guess I'm the only one...

Looks like people have been reporting font problems forever on the bug tracking.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: TButton and TListBox fonts
« Reply #5 on: August 28, 2019, 12:21:23 am »
I know I have a number of internal Lazarus Mac apps for accounting that do use a fixed-point font for listboxes so everything lines up correctly. I guess I'm the only one...
you actually sound pretty proficient in macOS development. Even considered making a patch?

Looks like people have been reporting font problems forever on the bug tracking.
i think it's rather a generic sizing issues.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: TButton and TListBox fonts
« Reply #6 on: August 28, 2019, 12:39:43 am »
I'm updating an application (re-configured for 64bit and Cocoa) and I noticed that TButton ... ignored the Font and ParentFont properties and just displayed whatever font they wanted to (I have no idea what it is, but it is larger than the room available).
you might want to try trunk with r61768 for TButtons

By the way, the default system font automatically adjusts to the button size.
« Last Edit: August 28, 2019, 12:47:23 am by skalogryz »

yazzdi

  • New Member
  • *
  • Posts: 16
Re: TButton and TListBox fonts
« Reply #7 on: September 04, 2019, 12:58:43 am »
I noticed that TListBox on 64 bit ignored font size changes until I added this line at the begin of FormCreate

ListBox1.Style := lbOwnerDrawFixed;

That allowed font size to be not “too big” and be the same as it was on 32 bit.
( as described here https://bugs.freepascal.org/view.php?id=36004 )



« Last Edit: September 04, 2019, 01:04:57 am by yazzdi »

certsoftor

  • New member
  • *
  • Posts: 8
Re: TButton and TListBox fonts
« Reply #8 on: September 06, 2019, 02:11:10 am »
Thanks yazzdl, that fixed it. I don't understand why it would be required, just a bug I guess. I found you can also just set that style in the form designer for the listbox and that way whatever font you select will display correctly there as well.


 

TinyPortal © 2005-2018