Problems with StyleBook Delphi 10.2
Hello. I am trying to make the display of a list of products inside a listbox. Previously a query is loaded and for each item of the request I will add an item inside the listbox. The fact is that I had to make a change in the style of the listbox item, which after editing and saving a stylebook is added in the form, in design mode the changes are shown on the screen, when I compile the system it always returns to the default style. I've done the editing of style defaul and from custom, I tried to apply both at runtime in the form's onactive, oncreate, and Onshow. I did a test creating a new project and using only one form and applying the same concept and it worked. But when I apply the same thing to the project I'm working on it doesn't work. I am not being able to apply style to the project.
Has anyone experienced this problem, or something like that?
The code that implements the addition of the items follows below:
procedure TfrmVisualPed.Button1Click(Sender: TObject);
var
Item:TListBoxItem;
begin
inherited;
if not DM.qryPedidosItens.IsEmpty then
begin
DM.qryPedidosItens.First;
ListBox1.BeginUpdate;
while not DM.qryPedidosItens.Eof do
begin
Item := TListBoxItem.Create(Nil);
item.StyleLookup := 'listboxitembottomdetail';
item.Width := 150;
item.Height := 150;
if FileExists('D:\TEMP\fotos\' + DM.qryPedidosItensCODIGO_PRODUTO.AsString + '.jpg') then
begin
Item.ItemData.Bitmap.LoadThumbnailFromFile('D:\TEMP\fotos\' + DM.qryPedidosItensCODIGO_PRODUTO.AsString + '.jpg',100,100);
end else
begin
Item.ItemData.Bitmap := imgsemfoto.Bitmap;
end;
Item.ItemData.Text := DM.qryPedidosItensCODIGO_PRODUTO.AsString;
item.Parent := ListBox1;
item.OnClick := Nil;
DM.qryPedidosItens.Next;
end;
ListBox1.EndUpdate;
ListBox1.ItemIndex := 0;
Application.ProcessMessages;
end;
end;
Here are some pictures: