Question

My problem. I an creating TListBoxItem and a TLabel in runtime. All components are created but TLabel style is not applied.

Do I have to call any other functions to apply style?

My code:

// LIST ITEM
LB_Item := TListBoxItem.Create(POSTAVKE);
with LB_Item do
begin
  Parent := POSTAVKE;
  Height := 50;
  Selectable := True;
end;
// LABEL 1
LB_Label1 := TLabel.Create(nil);
with LB_Label1 do
begin
  Parent := LB_Item;
  Align := TAlignLayout.alLeft;
  Width := 50;
  Font.Size := 12;
  TextAlign := TTextAlign.taCenter;
  Text := IntToStr(Kolicina);
  Font.Size := 14;
  Font.Style := [TFontStyle.fsBold];
  FontColor := TAlphaColorRec.Darkslategray;
  HitTest := False;
end;

......

Application.ProcessMessages;

enter image description here

Was it helpful?

Solution

At runtime you need to change the value in the StyledSettings property:

StyledSettings := StyledSettings - [TStyledSetting.ssFamily, TStyledSetting.ssSize, TStyledSetting.ssStyle];

should do it for you.

http://docwiki.embarcadero.com/Libraries/XE5/en/FMX.Types.TStyledSetting

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top