View Issue Details

IDProjectCategoryView StatusLast Update
0038976LazarusLCLpublic2021-06-11 00:31
ReporterCode-learn Assigned ToMichl  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
OSWindows 
Product Version2.0.12 
Fixed in Version2.1 (SVN) 
Summary0038976: TLabel.ParentColor and TCheckbox.ParentFont not working on run time
Description01- Label1.ParentColor set to TRUE in object inspector and application files saved. During execution Form1.Color is changed but Label1 backgroud color do not change. Only if Label1.ParentColor is set to TRUE at run time in the TForm1.FormCreate event execution, then the background color of Label1 keeps matching the Form1.Color as expected.

02- Checkbox1.ParentFont and CheckBox1.ParentColor set to TRUE at run time in the TForm1.CheckBox1Click event (CheckBox1.ParentFont:=CheckBox1.Checked;). When Form1.Color is changed CheckBox1.Color also change. But when TForm1.Font.Color is changed, CheckBox1.Font.Color does not change.
Steps To Reproduce01. Create a new application.
02. Add in the form Label1: Tlabel
03. In the Object Inspector set Label1.ParentColor and Label1.ParentFont to TRUE.
04. Add in the form CheckBox1: TCheckBox
05. In the Object Inspector set CheckBox1.Checked, CheckBox1.ParentColor and CheckBox1.ParentFont to TRUE.
06. Add in the form cbFWD:TColorBox. (Change the name of the Colorbox1 to cbFWD in the Object Inspector).
07. Add in the form cbBGRD:TColorBox. (Change the name of the Colorbox2 to cbBGRDin the Object Inspector).
08. Add the four following event handlers:
procedure TForm1.FormCreate(Sender: TObject);
begin
  Color:=cbBGRD.Selected;
  Font.Color:=cbFWD.Selected;
end;

procedure TForm1.cbFWDChange(Sender: TObject);
begin
  Font.Color:=cbFWD.Selected;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  CheckBox1.ParentColor:=CheckBox1.Checked;
  CheckBox1.ParentFont:=CheckBox1.Checked;
end;

procedure TForm1.cbBGRDChange(Sender: TObject);
begin
  Color:=cbBGRD.Selected;
end;
 
09. Run the application.
10. Change the colors selected in both color boxes and observe that Label1 background color don't change and Checkbox1 font color also don't change in spite it is checked.
Additional InformationThis is a basic example application from a learning book I'm reading.
TagsNo tags attached.
Fixed in Revision65189
LazTarget-
WidgetsetWin32/Win64
Attached Files

Relationships

related to 0038979 closedMichl CheckBox.ParentFont does not work as needed 

Activities

Code-learn

2021-06-08 03:31

reporter  

Application window at start.JPG (19,500 bytes)   
Application window at start.JPG (19,500 bytes)   
Parntfrm.txt (1,100 bytes)   
unit Parntfrm;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ColorBox;

type

  { TForm1 }

  TForm1 = class(TForm)
    CheckBox1: TCheckBox;
    cbFWD: TColorBox;
    cbBGRD: TColorBox;
    Label1: TLabel;
    StaticText1: TStaticText;
    StaticText2: TStaticText;
    procedure cbBGRDChange(Sender: TObject);
    procedure cbFWDChange(Sender: TObject);
    procedure CheckBox1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.FormCreate(Sender: TObject);
begin
  Color:=cbBGRD.Selected;
  Font.Color:=cbFWD.Selected;
end;

procedure TForm1.cbFWDChange(Sender: TObject);
begin
  Font.Color:=cbFWD.Selected;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  CheckBox1.ParentColor:=CheckBox1.Checked;
  CheckBox1.ParentFont:=CheckBox1.Checked;
end;

procedure TForm1.cbBGRDChange(Sender: TObject);
begin
  Color:=cbBGRD.Selected;
end;

end. 
Parntfrm.txt (1,100 bytes)   

Michl

2021-06-09 19:39

developer   ~0131217

Next time please add the example as zip (only files with endings pas, lfm, lpr, lpi)!

I only could see the issue with ParentColor. ParentFont is working correct for me. If not, please open a new bug report!

Please test Lazarus Trunk revision 65189 and close if OK.

CudaText man

2021-06-09 20:50

reporter   ~0131218

posted to 0038979 .

Code-learn

2021-06-11 00:23

reporter   ~0131235

Michl => Next time please add the example as zip (only files with endings pas, lfm, lpr, lpi)!
Answer: OK I will. Sorry about that.


Michl => only could see the issue with ParentColor. ParentFont is working correct for me. If not, please open a new bug report!
Answer: Actualy the issue with class TLabel was with ParentColor only, not with ParentFont. And with class TCheckBox it's the other way around: ParentColor OK and ParentFont.Color not working. But it was later explained by another member, that the TCheckBox.ParentFont.Color is actualy not suposed to change: instead it shall keep the OS standart color for check boxes, so there is no issue about it.

Michl => Please test Lazarus Trunk revision 65189 and close if OK.
Answer: I don't know yet how to install and test a Lazarus Trunk revision (will try to find out how), but I believe that if you found and correct the TLabel.ParentColor issue I should close this report.
Thank you very much.

Code-learn

2021-06-11 00:31

reporter   ~0131236

Michl => only could see the issue with ParentColor. ParentFont is working correct for me. If not, please open a new bug report!
Answer: Actualy the issue with class TLabel was with ParentColor only, not with ParentFont. And with class TCheckBox it's the other way around: ParentColor OK and ParentFont.Color not working. But it was later explained by another member, that the TCheckBox.ParentFont.Color is actualy not suposed to change: instead it shall keep the OS standart color for check boxes, so there is no issue about it.

Michl => Please test Lazarus Trunk revision 65189 and close if OK.
Answer: I don't know yet how to install and test a Lazarus Trunk revision (will try to find out how), but I believe that if you found and correct the TLabel.ParentColor issue I should close this report.
Thank you very much.

Issue History

Date Modified Username Field Change
2021-06-08 03:31 Code-learn New Issue
2021-06-08 03:31 Code-learn File Added: Application window at start.JPG
2021-06-08 03:31 Code-learn File Added: Application window after changing colors boxes.JPG
2021-06-08 03:31 Code-learn File Added: Parntfrm.txt
2021-06-09 18:38 Michl Assigned To => Michl
2021-06-09 18:38 Michl Status new => assigned
2021-06-09 19:39 Michl Status assigned => resolved
2021-06-09 19:39 Michl Resolution open => fixed
2021-06-09 19:39 Michl Fixed in Version => 2.1 (SVN)
2021-06-09 19:39 Michl Fixed in Revision => 65189
2021-06-09 19:39 Michl LazTarget => -
2021-06-09 19:39 Michl Widgetset Win32/Win64 => Win32/Win64
2021-06-09 19:39 Michl Note Added: 0131217
2021-06-09 20:50 CudaText man Note Added: 0131218
2021-06-10 12:09 Michl Relationship added related to 0038979
2021-06-11 00:23 Code-learn Note Added: 0131235
2021-06-11 00:31 Code-learn Status resolved => closed
2021-06-11 00:31 Code-learn Note Added: 0131236