I have followed the sample supplied by EMB that can be found on
"C:\Users\Public\Documents\Embarcadero\Studio\14.0\Samples\Object Pascal\FireMonkey Desktop\CustomListBox"
this is how it looks like:
This is the code that add the row to the listbox:
procedure TfrmCustomList.Button2Click(Sender: TObject);
var
Item: TListBoxItem;
begin
// create custom item
Item := TListBoxItem.Create(nil);
Item.Parent := ListBox1;
Item.StyleLookup := 'CustomItem';
Item.Text := 'item ' + IntToStr(Item.Index); // set filename
if Odd(Item.Index) then
Item.ItemData.Bitmap := Image1.Bitmap // set thumbnail
else
Item.ItemData.Bitmap := Image2.Bitmap; // set thumbnail
Item.StylesData['resolution'] := '1024x768 px'; // set size
Item.StylesData['depth'] := '32 bit';
Item.StylesData['visible'] := true; // set Checkbox value
Item.StylesData['visible.OnChange'] := TValue.From<TNotifyEvent>(DoVisibleChange); // set OnChange value
Item.StylesData['info.OnClick'] := TValue.From<TNotifyEvent>(DoInfoClick); // set OnClick value
end;
As you can see there is this line where the custom style is applyed:
Item.StyleLookup := 'CustomItem';
There is a StyleBook on the form, and the form is associated to it. The TListBox has not style applied.
However if you change this CustomItem Style, nothing happens. You can even change the names of the itens and nothing happens (not visual change at all) the layout keeps fixed as it is shown on the windows above.
I have added another TTlabel with its own name and tried to assign to it:
Item.StylesData['ghost'] := 'scary thing';
It does not give any error, but no text is shown. The style keeps immutable.
If removed the Item.StyleLookup assignment when creating the item the only thing changed is that the name of the TLabel are lost and then there is no way to assign the value.
So, the style is defined, but I see somehow it seems to be fixed. Any layout change is not applied, somehow seems to only understand the style sub items name changing. That is not useful at all.
How can I truly modify this style? I want to put each of the 3 TLabels side by side in a horizontal layout.