I wonder how to use this function because WEBLIB is not defined.
If I uncomment the switch it works.
procedure TTMSFNCBitmapContainer.AddFromURL(URL, BitmapName: string);
{.$IFDEF WEBLIB}
var
bmpi: TTMSFNCBitmapItem;
{.$ENDIF}
begin
{.$IFDEF WEBLIB}
bmpi := Self.Items.Add;
bmpi.Bitmap.LoadFromURL(URL);
bmpi.Name := BitmapName;
{.$ENDIF}
end;
Pieter
(Pieter)
March 19, 2021, 4:22pm
2
This is because the AddFromURL is only working for a TMS WEB Core application. If you want to download images from an URL inside an FMX application, please use the TTMSFNCURLBitmapContainer instead.
Works. I have to load the urlImages in the moment I expand the tree. But the tree does not show the bitmap unless I click somewhere on the tree. Do I have to call a kind of update?
Pieter
(Pieter)
March 19, 2021, 4:52pm
4
The TTMSFNCURLBitmapContainer OnDownloadComplete event can be used to repaint the treeview
I tried already tree.repaint but has no effect.
Pieter
(Pieter)
March 19, 2021, 5:19pm
6
Can you try
TMSFNCTreeView1.BeginUpdate;
TMSFNCTreeView1.EndUpdate;
I found this workaround.
Instead of
BitmapContainer.AddFromURL(imgName, aPath);
I have to give space before the bitmap is actually loaded.
bmpi := BitmapContainer.Items.Add;
bmpi.Bitmap.SetSize(fsize);
bmpi.Bitmap.Clear(TAlphaColorRec.null);
bmpi.Bitmap.LoadFromURL(imgCmd);
bmpi.Name := imgName;
Maybe the sizing of the node is not done after bitmap "arrives".
Pieter
(Pieter)
March 20, 2021, 8:48am
8
This is because once the treeview is initialized, the bitmap size is set. You can reset the node structure with ClearNodeList.
TMSFNCTreeView1.BeginUpdate;
TMSFNCTreeView1.ClearNodeList;
TMSFNCTreeView1.EndUpdate;