TLabel.ParentColor and TCheckbox.ParentFont not working on run time
Original Reporter info from Mantis: Code-learn
-
Reporter name: Code-learn
Original Reporter info from Mantis: Code-learn
- Reporter name: Code-learn
Description:
01- 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 reproduce:
- Create a new application.
- Add in the form Label1: Tlabel
- In the Object Inspector set Label1.ParentColor and Label1.ParentFont to TRUE.
- Add in the form CheckBox1: TCheckBox
- In the Object Inspector set CheckBox1.Checked, CheckBox1.ParentColor and CheckBox1.ParentFont to TRUE.
- Add in the form cbFWD:TColorBox. (Change the name of the Colorbox1 to cbFWD in the Object Inspector).
- Add in the form cbBGRD:TColorBox. (Change the name of the Colorbox2 to cbBGRDin the Object Inspector).
- 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 information:
This is a basic example application from a learning book I'm reading.
Mantis conversion info:
- Mantis ID: 38976
- OS: Windows
- OS Build: 10
- Version: 2.0.12
- Fixed in version: 2.1 (SVN)
- Fixed in revision: 65189 (#53362c37)