Recent

Author Topic: How Set GroupBox Font to Bold? Bug?  (Read 2033 times)

Dan3468298

  • Full Member
  • ***
  • Posts: 131
How Set GroupBox Font to Bold? Bug?
« on: June 25, 2020, 09:16:43 pm »
On MacOS Catalina, I have GroupBox with 2 RadioButton's.   I want to make GroupBox.Caption.fsBold=True but when I select that property for the GroupBox it only makes the RadioButtons label bold.   Am I missing something or is this a bug?
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: How Set GroupBox Font to Bold? Bug?
« Reply #1 on: June 25, 2020, 09:32:24 pm »
I don't know how it is in Cocoa but for the other widgetsets there is no: GroupBox.Caption.fsBold, since Caption is just a String.

If you mean setting:
Code: Pascal  [Select][+][-]
  1. AGroupBox.Font.Style += [fsBold];
then it might or might not work; I don't know if that's the case with Cocoa but some themed Window/Composition Managers don't allow to change some properties away from what the "theme" directs, whether it's the font, colors, etc.

However I've very little knowledge of Cocoa (and MacOS X in general) so this might not be what's causing your trouble. :-[
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Dan3468298

  • Full Member
  • ***
  • Posts: 131
Re: How Set GroupBox Font to Bold? Bug?
« Reply #2 on: June 25, 2020, 09:39:42 pm »
Yeah, sorry about that.  I want the fsBold to apply to the Caption font which isn't happening.  I am specifying that in the Object Inspector. 
« Last Edit: June 25, 2020, 09:41:22 pm by Dan3468298 »
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: How Set GroupBox Font to Bold? Bug?
« Reply #3 on: June 25, 2020, 11:27:51 pm »
Cover that area with a control that you can fully paint yourself like  TPaintBox for example.

 During the Onpaint handler, fill the surface with the background color and then write your text in the color you wish..

 Kind of a hooky way of doing it but it work.

 If you set the parent of the Tpaintbox to that of the base control then it should follow the base control around the screen as you resize or move things.
The only true wisdom is knowing you know nothing

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: How Set GroupBox Font to Bold? Bug?
« Reply #4 on: June 26, 2020, 01:36:11 am »
I did a small test here (Xubuntu 18.04-amd64, Lazarus/FPC 2.0.8/3.0.4 gtk2) and it worked right (see attached image) so it indeed looks as a widgetset-dependent behaviour.

The program is just a button, a groupbox and, inside it, two radio buttons, and the test is just this simple button-click  handler:

Code: Pascal  [Select][+][-]
  1. procedure TMainForm.btDoTestClick(Sender: TObject);
  2. begin
  3.   if fsBold in GroupBox1.Font.Style then
  4.     GroupBox1.Font.Style := GroupBox1.Font.Style - [fsBold]
  5.   else
  6.     GroupBox1.Font.Style := GroupBox1.Font.Style + [fsBold];
  7. end;

Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Dan3468298

  • Full Member
  • ***
  • Posts: 131
Re: How Set GroupBox Font to Bold? Bug?
« Reply #5 on: June 26, 2020, 11:46:02 pm »
Using your code here are my results (attached) which confirms the bug.   Note I only want the caption bold and override per child control works.  Should I file a bug report?
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: How Set GroupBox Font to Bold? Bug?
« Reply #6 on: June 27, 2020, 07:01:48 am »
Note I only want the caption bold and override per child control works.

It should. In my case the children become bold because they have ParentFont to True; setting any font property for them should make it False and allow them to use their own font.

Quote
Should I file a bug report?

You might, though I suspect this will end up being "expected behaviour" for Cocoa. Remember to search first in the bug-tracker, it's probable this has already been noticed.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Dan3468298

  • Full Member
  • ***
  • Posts: 131
Re: How Set GroupBox Font to Bold? Bug?
« Reply #7 on: June 28, 2020, 04:33:27 am »
Filed Bug Report.  Bug ID is 0037279.
« Last Edit: June 28, 2020, 08:15:21 pm by Dan3468298 »
MacOS 10.15.5/Lazarus 2.0.10 Build 2020-07-07

 

TinyPortal © 2005-2018