How to make items in a FMX TListBox bold?

515 Views Asked by At

How can I make the items in my FMX TListBox bold? I can't find anything by myself, either in the documentation or the Internet.

3

There are 3 best solutions below

0
LightFox7 On BEST ANSWER

Thanks to Gregg who gave a working answer for delphi, i'll put a C++Builder version here.

I made a loop over my ListBox with the item count, and it does not affect the loading speed of the ListBox (around 4000 items in my case) so it's a good solution at least for me.

ListBox->ListItems[x]->StyledSettings = ListBox->ListItems[x]->StyledSettings >> TStyledSetting::Style;
ListBox->ListItems[x]->Font->Style = ListBox->ListItems[x]->Font->Style << fsBold;
2
Станислав 000 On

You can use custom theme for TListBoxItems. Create one by right mouse on ListBox.

0
Gregg On

You need to set two properties for the tListItem in question. The first line of code below lets you set the font properties for that ListItem rather than having the style dictate the font properties (if you miss this step, the next step will have no affect). The second line sets that ListItem to bold (where, of course, x is the index within the list that should be made bold)

ListBox1.ListItems[x].StyledSettings:=[];
ListBox1.ListItems[x].Font.Style:=[TFontStyle.fsBold];