hi everyone

hi everyone,
I have problem with TComboBox in #firemonkey application ( #DelphiXE4  )
I want to change text color in ComboBox, I mean text wich we see when combobox is its usual state.

I've created custom style for combobox and changed color in foreground object as in TEdit. Nothing changed.

After that I googled that I should change TListBoxItem style, (seems it is little bit differrent things). no luck here too.

Also I tried to iterate through item and change TextSettings property. no luck anyway.

does anyone know how to do that (color of text in ComboBox itself, not in popup)?

Comments

  1. Hello Andrew,

    In XE3 and later before changing styled settings you should tell to the system, which options will be styled and which custom. To change TextColor you should insert before:

    StyledSettings := [TStyledSetting.ssFamily, TStyledSetting.ssSize, TStyledSetting.ssStyle,  {TStyledSetting.ssFontColor,} TStyledSetting.ssOther];

    This line tell to compiler, that we use not styled FontColor. After this line you can try to change TextColor

    ReplyDelete
  2. Alex Egorov do you mean TListBoxItem.StyledSettings?

    my code is:
        ic := ComboBox1 as IItemsContainer;
        for i := 0 to ic.GetItemsCount() - 1 do begin
            li := ic.GetItem(i) as TListBoxItem;
            li.StyledSettings := li.StyledSettings - [TStyledSetting.ssFontColor];
            li.FontColor := $ffff0000;
        end;
    no changes in appearance.

    anyway, imho, listItem style applies to popup list in combobox, not to Combo text itself. isn't it ?

    ReplyDelete
  3. Try also to remove ssOther attribute

    ReplyDelete
  4. Alex Egorov ssOther doesn't help.

    I tried to create new test application, loaded Blend style to StyleBook, after thath i changed ListBoxItemStyle.Text.Color to red, and my combobox text became red.
    But the same thing does not work with Diamond style, which my actual application uses

    ReplyDelete
  5. ok, problem solved.
    there was ColorAnimation in Text object of listboxItemStyle in Diamond style, which was triggered by IsSelected trigger. I thought "IsSelected" means that control has focus, but it refers to ItemIndex property

    ReplyDelete

Post a Comment