JimKueneman 1 Posted December 22, 2022 (edited) Hi, Delphi 11.2 Patch 1, FireMonkey app running in Windows 11 in a virtual Machine on OSX. Does not work compiled into Linux or OSX either. procedure TForm1.Button4Click(Sender: TObject); var L: TLabel; begin Label1.TextSettings.Font.Style := [TFontStyle.fsBold]; // Desiger Dropped Label is Bold L := TLabel.Create(Self); L.Text := 'Testing'; L.Align := TAlignLayout.Bottom; L.TextSettings.Font.Style := [TFontStyle.fsBold]; // Dynamically created Label is not Bold L.Parent := Layout1; end; Why won't the dynamically added Label respond to changing TextSettings.Font.Style? Jim Edited December 22, 2022 by JimKueneman Share this post Link to post
Lajos Juhász 320 Posted December 22, 2022 Most probably you've changed the Label1.StyledSettings property. I've tried with the default settings of the TLabel you cannot change the style from the code. In order to work you have to add: L.StyledSettings:=L.StyledSettings-[TStyledSetting.Style]; 1 Share this post Link to post
KimHJ 4 Posted Thursday at 10:42 PM I have the same problem in Delphi 12. I tried to add the line L.StyledSettings:=L.StyledSettings-[TStyledSetting.Style]; but no change. Panel1 := TPanel.Create(self); Panel1.Height := 49; Panel1.Parent := FramedVertScrollBox1; Panel1.Align := TAlignLayout.Top; Panel1.StyleLookup := 'calloutpanelstyle'; Panel1.Height := 60; L1 := Tlabel.Create(self); L1.Parent := Panel1; L1.Width := 150; L1.Height := 38; L1.Align := TAlignLayout.Left; L1.Margins.Left := 15; L1.Margins.Top := 10; L1.TextSettings.Font.Family := 'Segoe UI Semibold'; L1.TextSettings.Font.Size :=30; L1.Text := JSONItems.Items[i].GetValue<string>('ticketnr'); L2 := Tlabel.Create(self); L2.Parent := Panel1; L2.Width := 150; L2.Height := 38; L2.Margins.Top := 10; L2.Align := TAlignLayout.Right; L2.TextSettings.Font.Family := 'Segoe UI Semibold'; L2.TextSettings.Font.Size :=30; L2.Text := DateToStr(ISO8601ToDate(JSONItems.Items[i].GetValue<string>('invdate'))); L1.StyledSettings:=L1.StyledSettings-[TStyledSetting.Style]; L2.StyledSettings:=L2.StyledSettings-[TStyledSetting.Style]; The font size dosen't change. Share this post Link to post
Lajos Juhász 320 Posted 21 hours ago The answer is the same as for the previous question you have to change the StyledSettings. In this case you are changing the Family and Style thus you have to remove those elements from the set, you do not change the Style of the font. You can replace: L1.StyledSettings:=L1.StyledSettings-[TStyledSetting.Style]; L2.StyledSettings:=L2.StyledSettings-[TStyledSetting.Style]; with: L1.StyledSettings:=[]; L2.StyledSettings:=[]; Share this post Link to post