Home > database >  FMX TListboxItem not showing Font color change
FMX TListboxItem not showing Font color change

Time:03-26

I have the following problem with using a custom style with a FMX TListBoxItem.

In the following code below, I have created four new styles to use in a TListBoxItem. All four styles show a box (TRectangle) with or without an X (TPath) in it and a TText to the right of it. In two of the styles, I show the X and the other two I don't. One style shows a green box with an X and text that is black and bold. One shows a empty box with just black text. The other two show the same thing but the boxes and the text are red, with the text for the one with the X in the box being bold.

In the program, I have a listbox with four listboxitems added during designtime to show the four different styles. I also have a button that will create an additional four listboxitems with code during runtime which also display the four different styles. All this works, except on one detail. The two red listboxitems that are created during runtime do not use the red font color. You can see this in the following image. ListboxItem1 and ListboxItem2 were created as designtime and are displayed with red text. "Item #1" and "Item #2" are displayed with black text but should be red. Note: "Item #2" does show the bold text correctly.

What am I missing when creating the Listboxitems during runtime that is keeping the red text from showing correctly?

enter image description here

Here's the code, form and styles I am using.

unit Unit3;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
  FMX.Controls.Presentation, FMX.StdCtrls, FMX.ListBox, FMX.Layouts,
  FMX.ListView.Types, FMX.ListView.Appearances, FMX.ListView.Adapters.Base,
  FMX.ListView;

type
  TForm3 = class(TForm)
    lbxEquipment: TListBox;
    ListBoxItem1: TListBoxItem;
    btnAdd: TButton;
    StyleBook1: TStyleBook;
    ListBoxItem2: TListBoxItem;
    Button2: TButton;
    ListBoxItem3: TListBoxItem;
    ListBoxItem4: TListBoxItem;
    procedure btnAddClick(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
  public
  end;

var
  Form3: TForm3;

implementation

{$R *.fmx}

uses System.Rtti, FMX.Objects;

var
  i: integer = 1;
  cnt: integer = 1;
  fColor: TAlphaColor;
  bColor: TAlphaColor;

procedure TForm3.btnAddClick(Sender: TObject);
  var
    s: string;
    vItem: TListBoxItem;
    c: integer;

begin
  for c := cnt to (cnt   3) do
    begin
      s := 'Item #'   IntToStr(c);
      vItem := TListBoxItem.Create(lbxEquipment);
      vItem.Parent := lbxEquipment;
      vItem.StyledSettings := vItem.StyledSettings - [TStyledSetting.FontColor];
      case I of
        1: vItem.StyleLookup := 'EquipItemRedOffStyle';
        2: vItem.StyleLookup := 'EquipItemRedOnStyle';
        3: vItem.StyleLookup := 'EquipItemOffStyle';
      else
        vItem.StyleLookup := 'EquipItemOnStyle';
      end;
      vItem.Text := s;
      Inc(i);
      if I > 3 then
        I := 0;
    end;
    cnt := c   1;
end;

procedure TForm3.Button2Click(Sender: TObject);
begin
  lbxEquipment.Clear;
end;

end.
object Form3: TForm3
  Left = 0
  Top = 0
  ActiveControl = lbxEquipment
  Caption = 'Form3'
  ClientHeight = 284
  ClientWidth = 324
  StyleBook = StyleBook1
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  object lbxEquipment: TListBox
    Anchors = [akLeft, akTop, akRight, akBottom]
    Position.X = 24.000000000000000000
    Position.Y = 104.000000000000000000
    Size.Width = 281.000000000000000000
    Size.Height = 157.000000000000000000
    Size.PlatformDefault = False
    TabOrder = 0
    Columns = 2
    DisableFocusEffect = True
    ItemIndex = 0
    DefaultItemStyles.ItemStyle = ''
    DefaultItemStyles.GroupHeaderStyle = ''
    DefaultItemStyles.GroupFooterStyle = ''
    ShowCheckboxes = True
    Viewport.Width = 277.000000000000000000
    Viewport.Height = 153.000000000000000000
    object ListBoxItem1: TListBoxItem
      IsSelected = True
      StyleLookup = 'EquipItemRedOffStyle'
      TabOrder = 0
      Text = 'ListBoxItem1'
    end
    object ListBoxItem2: TListBoxItem
      Position.X = 138.000000000000000000
      StyleLookup = 'EquipItemRedOnStyle'
      TabOrder = 1
      Text = 'ListBoxItem2'
    end
    object ListBoxItem3: TListBoxItem
      Position.Y = 19.000000000000000000
      StyleLookup = 'EquipItemOffStyle'
      TabOrder = 2
      Text = 'ListBoxItem3'
    end
    object ListBoxItem4: TListBoxItem
      Position.X = 138.000000000000000000
      Position.Y = 19.000000000000000000
      StyleLookup = 'EquipItemOnStyle'
      TabOrder = 3
      Text = 'ListBoxItem4'
    end
  end
  object btnAdd: TButton
    Position.X = 24.000000000000000000
    Position.Y = 64.000000000000000000
    TabOrder = 1
    Text = 'Add'
    OnClick = btnAddClick
  end
  object StyleBook1: TStyleBook
    Styles = <
      item
      end
      item
        Platform = 'Windows 10 Desktop'
        ResourcesBin = {
          464D585F5354594C4520322E3501061145717569704974656D4F66665374796C
          6503B204061345717569704974656D5265644F6E5374796C6503FD0406104571
          7569704974656D4F6E5374796C6503DF04061445717569704974656D5265644F
          66665374796C6503E304005450463007544C61796F757400095374796C654E61
          6D65061145717569704974656D4F66665374796C6505416C69676E070643656E
          7465720A53697A652E57696474680500000000000000C406400B53697A652E48
          656967687405000000000000009803401453697A652E506C6174666F726D4465
          6661756C7408085461624F7264657202250016544163746976655374796C6554
          6578744F626A65637400095374796C654E616D6506047465787405416C69676E
          0706436C69656E740C4D617267696E732E4C6566740500000000000000C00040
          0B4D617267696E732E546F70050000000000000080FF3F0D4D617267696E732E
          52696768740500000000000000C000400E4D617267696E732E426F74746F6D05
          0000000000000080FF3F0A53697A652E57696474680500000000000000AC0640
          0B53697A652E48656967687405000000000000008803401453697A652E506C61
          74666F726D44656661756C740804546578740604546578741554657874536574
          74696E67732E576F72645772617008165465787453657474696E67732E486F72
          7A416C69676E07074C656164696E670D536861646F7756697369626C65080D41
          637469766554726967676572070853656C65637465640B416374697665436F6C
          6F720708636C61426C61636B000007544C61796F75740005416C69676E07044C
          656674064C6F636B6564090A53697A652E576964746805000000000000009003
          400B53697A652E48656967687405000000000000009803401453697A652E506C
          6174666F726D44656661756C7408085461624F726465720200000A5452656374
          616E676C6500095374796C654E616D65060965717569706261636B05416C6967
          6E0706436C69656E74064C6F636B6564090748697454657374080C4D61726769
          6E732E4C65667405000000000000008000400B4D617267696E732E546F700500
          0000000000008000400D4D617267696E732E5269676874050000000000000080
          00400E4D617267696E732E426F74746F6D05000000000000008000400A53697A
          652E57696474680500000000000000E002400B53697A652E4865696768740500
          000000000000F002401453697A652E506C6174666F726D44656661756C740807
          5852616469757305000000000000008000400759526164697573050000000000
          00008000400005545061746800095374796C654E616D65060A65717569706368
          65636B05416C69676E0706436C69656E7409446174612E506174680A34000000
          04000000000000000000000000000000010000000000803F0000803F00000000
          000000000000803F010000000000803F00000000064C6F636B65640907486974
          54657374080C4D617267696E732E4C656674050000000000000080FF3F0B4D61
          7267696E732E546F70050000000000000080FF3F0D4D617267696E732E526967
          6874050000000000000080FF3F0E4D617267696E732E426F74746F6D05000000
          0000000080FF3F0A53697A652E57696474680500000000000000C002400B5369
          7A652E4865696768740500000000000000D002401453697A652E506C6174666F
          726D44656661756C74080B5374726F6B652E4B696E6407044E6F6E6510537472
          6F6B652E546869636B6E65737305000000000000008000400000000000545046
          3007544C61796F757400095374796C654E616D65061345717569704974656D52
          65644F6E5374796C6505416C69676E070643656E7465720A53697A652E576964
          74680500000000000000C406400B53697A652E48656967687405000000000000
          009803401453697A652E506C6174666F726D44656661756C7408075669736962
          6C6508085461624F7264657202240016544163746976655374796C6554657874
          4F626A65637400095374796C654E616D6506047465787405416C69676E070643
          6C69656E740C4D617267696E732E4C6566740500000000000000C000400B4D61
          7267696E732E546F70050000000000000080FF3F0D4D617267696E732E526967
          68740500000000000000C000400E4D617267696E732E426F74746F6D05000000
          0000000080FF3F0A53697A652E57696474680500000000000000AC06400B5369
          7A652E48656967687405000000000000008803401453697A652E506C6174666F
          726D44656661756C74081A5465787453657474696E67732E466F6E742E537479
          6C654578740A0D00000000070000000000000004000000165465787453657474
          696E67732E466F6E74436F6C6F720706636C6152656415546578745365747469
          6E67732E576F72645772617008165465787453657474696E67732E486F727A41
          6C69676E07074C656164696E670D536861646F7756697369626C65080D416374
          69766554726967676572070853656C65637465640B416374697665436F6C6F72
          0706636C61526564000007544C61796F75740005416C69676E07044C65667406
          4C6F636B6564090A53697A652E576964746805000000000000009003400B5369
          7A652E48656967687405000000000000009803401453697A652E506C6174666F
          726D44656661756C7408085461624F726465720200000A5452656374616E676C
          6500095374796C654E616D65060965717569706261636B05416C69676E070643
          6C69656E740A46696C6C2E436F6C6F720706636C61526564064C6F636B656409
          0748697454657374080C4D617267696E732E4C65667405000000000000008000
          400B4D617267696E732E546F7005000000000000008000400D4D617267696E73
          2E526967687405000000000000008000400E4D617267696E732E426F74746F6D
          05000000000000008000400A53697A652E57696474680500000000000000E002
          400B53697A652E4865696768740500000000000000F002401453697A652E506C
          6174666F726D44656661756C7408075852616469757305000000000000008000
          4007595261646975730500000000000000800040000554506174680009537479
          6C654E616D65060A6571756970636865636B05416C69676E0706436C69656E74
          09446174612E506174680A340000000400000000000000000000000000000001
          0000000000803F0000803F00000000000000000000803F010000000000803F00
          000000064C6F636B6564090748697454657374080C4D617267696E732E4C6566
          74050000000000000080FF3F0B4D617267696E732E546F700500000000000000
          80FF3F0D4D617267696E732E5269676874050000000000000080FF3F0E4D6172
          67696E732E426F74746F6D050000000000000080FF3F0A53697A652E57696474
          680500000000000000C002400B53697A652E4865696768740500000000000000
          D002401453697A652E506C6174666F726D44656661756C7408105374726F6B65
          2E546869636B6E65737305000000000000008000400000000000545046300754
          4C61796F757400095374796C654E616D65061045717569704974656D4F6E5374
          796C6505416C69676E070643656E7465720A53697A652E576964746805000000
          00000000C406400B53697A652E48656967687405000000000000009803401453
          697A652E506C6174666F726D44656661756C74080756697369626C6508085461
          624F7264657202220016544163746976655374796C65546578744F626A656374
          00095374796C654E616D6506047465787405416C69676E0706436C69656E740C
          4D617267696E732E4C6566740500000000000000C000400B4D617267696E732E
          546F70050000000000000080FF3F0D4D617267696E732E526967687405000000
          00000000C000400E4D617267696E732E426F74746F6D050000000000000080FF
          3F0A53697A652E57696474680500000000000000AC06400B53697A652E486569
          67687405000000000000008803401453697A652E506C6174666F726D44656661
          756C74081A5465787453657474696E67732E466F6E742E5374796C654578740A
          0D00000000070000000000000004000000155465787453657474696E67732E57
          6F72645772617008165465787453657474696E67732E486F727A416C69676E07
          074C656164696E670D536861646F7756697369626C65080D4163746976655472
          6967676572070853656C65637465640B416374697665436F6C6F720708636C61
          426C61636B000007544C61796F75740005416C69676E07044C656674064C6F63
          6B6564090A53697A652E576964746805000000000000009003400B53697A652E
          48656967687405000000000000009803401453697A652E506C6174666F726D44
          656661756C7408085461624F726465720200000A5452656374616E676C650009
          5374796C654E616D65060965717569706261636B05416C69676E0706436C6965
          6E740A46696C6C2E436F6C6F720708636C61477265656E064C6F636B65640907
          48697454657374080C4D617267696E732E4C6566740500000000000000800040
          0B4D617267696E732E546F7005000000000000008000400D4D617267696E732E
          526967687405000000000000008000400E4D617267696E732E426F74746F6D05
          000000000000008000400A53697A652E57696474680500000000000000E00240
          0B53697A652E4865696768740500000000000000F002401453697A652E506C61
          74666F726D44656661756C740807585261646975730500000000000000800040
          075952616469757305000000000000008000400005545061746800095374796C
          654E616D65060A6571756970636865636B05416C69676E0706436C69656E7409
          446174612E506174680A34000000040000000000000000000000000000000100
          00000000803F0000803F00000000000000000000803F010000000000803F0000
          0000064C6F636B6564090748697454657374080C4D617267696E732E4C656674
          050000000000000080FF3F0B4D617267696E732E546F70050000000000000080
          FF3F0D4D617267696E732E5269676874050000000000000080FF3F0E4D617267
          696E732E426F74746F6D050000000000000080FF3F0A53697A652E5769647468
          0500000000000000C002400B53697A652E4865696768740500000000000000D0
          02401453697A652E506C6174666F726D44656661756C7408105374726F6B652E
          546869636B6E657373050000000000000080004000000000005450463007544C
          61796F757400095374796C654E616D65061445717569704974656D5265644F66
          665374796C6505416C69676E070643656E7465720A53697A652E576964746805
          00000000000000C406400B53697A652E48656967687405000000000000009803
          401453697A652E506C6174666F726D44656661756C74080756697369626C6508
          085461624F7264657202230016544163746976655374796C65546578744F626A
          65637400095374796C654E616D6506047465787405416C69676E0706436C6965
          6E740C4D617267696E732E4C6566740500000000000000C000400B4D61726769
          6E732E546F70050000000000000080FF3F0D4D617267696E732E526967687405
          00000000000000C000400E4D617267696E732E426F74746F6D05000000000000
          0080FF3F0A53697A652E57696474680500000000000000AC06400B53697A652E
          48656967687405000000000000008803401453697A652E506C6174666F726D44
          656661756C7408165465787453657474696E67732E466F6E74436F6C6F720706
          636C61526564155465787453657474696E67732E576F72645772617008165465
          787453657474696E67732E486F727A416C69676E07074C656164696E670D5368
          61646F7756697369626C65080D41637469766554726967676572070853656C65
          637465640B416374697665436F6C6F720706636C61526564000007544C61796F
          75740005416C69676E07044C656674064C6F636B6564090A53697A652E576964
          746805000000000000009003400B53697A652E48656967687405000000000000
          009803401453697A652E506C6174666F726D44656661756C7408085461624F72
          6465720200000A5452656374616E676C6500095374796C654E616D6506096571
          7569706261636B05416C69676E0706436C69656E740A46696C6C2E436F6C6F72
          0706636C61526564064C6F636B6564090748697454657374080C4D617267696E
          732E4C65667405000000000000008000400B4D617267696E732E546F70050000
          00000000008000400D4D617267696E732E526967687405000000000000008000
          400E4D617267696E732E426F74746F6D05000000000000008000400A53697A65
          2E57696474680500000000000000E002400B53697A652E486569676874050000
          0000000000F002401453697A652E506C6174666F726D44656661756C74080758
          5261646975730500000000000000800040075952616469757305000000000000
          008000400005545061746800095374796C654E616D65060A6571756970636865
          636B05416C69676E0706436C69656E7409446174612E506174680A3400000004
          000000000000000000000000000000010000000000803F0000803F0000000000
          0000000000803F010000000000803F00000000064C6F636B6564090748697454
          657374080C4D617267696E732E4C656674050000000000000080FF3F0B4D6172
          67696E732E546F70050000000000000080FF3F0D4D617267696E732E52696768
          74050000000000000080FF3F0E4D617267696E732E426F74746F6D0500000000
          00000080FF3F0A53697A652E57696474680500000000000000C002400B53697A
          652E4865696768740500000000000000D002401453697A652E506C6174666F72
          6D44656661756C74080B5374726F6B652E4B696E6407044E6F6E65105374726F
          6B652E546869636B6E65737305000000000000008000400000000000}
      end>
    Left = 136
    Top = 16
  end
  object Button2: TButton
    Position.X = 200.000000000000000000
    Position.Y = 64.000000000000000000
    TabOrder = 5
    Text = 'Clear'
    OnClick = Button2Click
  end
end
object TStyleContainer
  object TLayout
    StyleName = 'EquipItemOffStyle'
    Align = Center
    Size.Width = 196.000000000000000000
    Size.Height = 19.000000000000000000
    Size.PlatformDefault = False
    Visible = False
    TabOrder = 37
    object TActiveStyleTextObject
      StyleName = 'text'
      Align = Client
      Margins.Left = 3.000000000000000000
      Margins.Top = 1.000000000000000000
      Margins.Right = 3.000000000000000000
      Margins.Bottom = 1.000000000000000000
      Size.Width = 172.000000000000000000
      Size.Height = 17.000000000000000000
      Size.PlatformDefault = False
      Text = 'Text'
      TextSettings.WordWrap = False
      TextSettings.HorzAlign = Leading
      ShadowVisible = False
      ActiveTrigger = Selected
      ActiveColor = claBlack
    end
    object TLayout
      Align = Left
      Locked = True
      Size.Width = 18.000000000000000000
      Size.Height = 19.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 0
      object TRectangle
        StyleName = 'equipback'
        Align = Client
        Locked = True
        HitTest = False
        Margins.Left = 2.000000000000000000
        Margins.Top = 2.000000000000000000
        Margins.Right = 2.000000000000000000
        Margins.Bottom = 2.000000000000000000
        Size.Width = 14.000000000000000000
        Size.Height = 15.000000000000000000
        Size.PlatformDefault = False
        XRadius = 2.000000000000000000
        YRadius = 2.000000000000000000
        object TPath
          StyleName = 'equipcheck'
          Align = Client
          Data.Path = {
            04000000000000000000000000000000010000000000803F0000803F00000000
            000000000000803F010000000000803F00000000}
          Locked = True
          HitTest = False
          Margins.Left = 1.000000000000000000
          Margins.Top = 1.000000000000000000
          Margins.Right = 1.000000000000000000
          Margins.Bottom = 1.000000000000000000
          Size.Width = 12.000000000000000000
          Size.Height = 13.000000000000000000
          Size.PlatformDefault = False
          Stroke.Kind = None
          Stroke.Thickness = 2.000000000000000000
        end
      end
    end
  end
  object TLayout
    StyleName = 'EquipItemRedOnStyle'
    Align = Center
    Size.Width = 196.000000000000000000
    Size.Height = 19.000000000000000000
    Size.PlatformDefault = False
    Visible = False
    TabOrder = 36
    object TActiveStyleTextObject
      StyleName = 'text'
      Align = Client
      Margins.Left = 3.000000000000000000
      Margins.Top = 1.000000000000000000
      Margins.Right = 3.000000000000000000
      Margins.Bottom = 1.000000000000000000
      Size.Width = 172.000000000000000000
      Size.Height = 17.000000000000000000
      Size.PlatformDefault = False
      TextSettings.Font.StyleExt = {00070000000000000004000000}
      TextSettings.FontColor = claRed
      TextSettings.WordWrap = False
      TextSettings.HorzAlign = Leading
      ShadowVisible = False
      ActiveTrigger = Selected
      ActiveColor = claRed
    end
    object TLayout
      Align = Left
      Locked = True
      Size.Width = 18.000000000000000000
      Size.Height = 19.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 0
      object TRectangle
        StyleName = 'equipback'
        Align = Client
        Fill.Color = claRed
        Locked = True
        HitTest = False
        Margins.Left = 2.000000000000000000
        Margins.Top = 2.000000000000000000
        Margins.Right = 2.000000000000000000
        Margins.Bottom = 2.000000000000000000
        Size.Width = 14.000000000000000000
        Size.Height = 15.000000000000000000
        Size.PlatformDefault = False
        XRadius = 2.000000000000000000
        YRadius = 2.000000000000000000
        object TPath
          StyleName = 'equipcheck'
          Align = Client
          Data.Path = {
            04000000000000000000000000000000010000000000803F0000803F00000000
            000000000000803F010000000000803F00000000}
          Locked = True
          HitTest = False
          Margins.Left = 1.000000000000000000
          Margins.Top = 1.000000000000000000
          Margins.Right = 1.000000000000000000
          Margins.Bottom = 1.000000000000000000
          Size.Width = 12.000000000000000000
          Size.Height = 13.000000000000000000
          Size.PlatformDefault = False
          Stroke.Thickness = 2.000000000000000000
        end
      end
    end
  end
  object TLayout
    StyleName = 'EquipItemOnStyle'
    Align = Center
    Size.Width = 196.000000000000000000
    Size.Height = 19.000000000000000000
    Size.PlatformDefault = False
    Visible = False
    TabOrder = 34
    object TActiveStyleTextObject
      StyleName = 'text'
      Align = Client
      Margins.Left = 3.000000000000000000
      Margins.Top = 1.000000000000000000
      Margins.Right = 3.000000000000000000
      Margins.Bottom = 1.000000000000000000
      Size.Width = 172.000000000000000000
      Size.Height = 17.000000000000000000
      Size.PlatformDefault = False
      TextSettings.Font.StyleExt = {00070000000000000004000000}
      TextSettings.WordWrap = False
      TextSettings.HorzAlign = Leading
      ShadowVisible = False
      ActiveTrigger = Selected
      ActiveColor = claBlack
    end
    object TLayout
      Align = Left
      Locked = True
      Size.Width = 18.000000000000000000
      Size.Height = 19.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 0
      object TRectangle
        StyleName = 'equipback'
        Align = Client
        Fill.Color = claGreen
        Locked = True
        HitTest = False
        Margins.Left = 2.000000000000000000
        Margins.Top = 2.000000000000000000
        Margins.Right = 2.000000000000000000
        Margins.Bottom = 2.000000000000000000
        Size.Width = 14.000000000000000000
        Size.Height = 15.000000000000000000
        Size.PlatformDefault = False
        XRadius = 2.000000000000000000
        YRadius = 2.000000000000000000
        object TPath
          StyleName = 'equipcheck'
          Align = Client
          Data.Path = {
            04000000000000000000000000000000010000000000803F0000803F00000000
            000000000000803F010000000000803F00000000}
          Locked = True
          HitTest = False
          Margins.Left = 1.000000000000000000
          Margins.Top = 1.000000000000000000
          Margins.Right = 1.000000000000000000
          Margins.Bottom = 1.000000000000000000
          Size.Width = 12.000000000000000000
          Size.Height = 13.000000000000000000
          Size.PlatformDefault = False
          Stroke.Thickness = 2.000000000000000000
        end
      end
    end
  end
  object TLayout
    StyleName = 'EquipItemRedOffStyle'
    Align = Center
    Size.Width = 196.000000000000000000
    Size.Height = 19.000000000000000000
    Size.PlatformDefault = False
    Visible = False
    TabOrder = 35
    object TActiveStyleTextObject
      StyleName = 'text'
      Align = Client
      Margins.Left = 3.000000000000000000
      Margins.Top = 1.000000000000000000
      Margins.Right = 3.000000000000000000
      Margins.Bottom = 1.000000000000000000
      Size.Width = 172.000000000000000000
      Size.Height = 17.000000000000000000
      Size.PlatformDefault = False
      TextSettings.FontColor = claRed
      TextSettings.WordWrap = False
      TextSettings.HorzAlign = Leading
      ShadowVisible = False
      ActiveTrigger = Selected
      ActiveColor = claRed
    end
    object TLayout
      Align = Left
      Locked = True
      Size.Width = 18.000000000000000000
      Size.Height = 19.000000000000000000
      Size.PlatformDefault = False
      TabOrder = 0
      object TRectangle
        StyleName = 'equipback'
        Align = Client
        Fill.Color = claRed
        Locked = True
        HitTest = False
        Margins.Left = 2.000000000000000000
        Margins.Top = 2.000000000000000000
        Margins.Right = 2.000000000000000000
        Margins.Bottom = 2.000000000000000000
        Size.Width = 14.000000000000000000
        Size.Height = 15.000000000000000000
        Size.PlatformDefault = False
        XRadius = 2.000000000000000000
        YRadius = 2.000000000000000000
        object TPath
          StyleName = 'equipcheck'
          Align = Client
          Data.Path = {
            04000000000000000000000000000000010000000000803F0000803F00000000
            000000000000803F010000000000803F00000000}
          Locked = True
          HitTest = False
          Margins.Left = 1.000000000000000000
          Margins.Top = 1.000000000000000000
          Margins.Right = 1.000000000000000000
          Margins.Bottom = 1.000000000000000000
          Size.Width = 12.000000000000000000
          Size.Height = 13.000000000000000000
          Size.PlatformDefault = False
          Stroke.Kind = None
          Stroke.Thickness = 2.000000000000000000
        end
      end
    end
  end
end
four```

CodePudding user response:

Remove the line

vItem.StyledSettings := vItem.StyledSettings - [TStyledSetting.FontColor];

Your text is red in the style, but you're telling it to ignore the font colour of the style!

  • Related