B4J Question images in BBlistview - there must be an easier way

johnmie

Active Member
Licensed User
Longtime User
Hello everybody,
my soon to be released healthy nutrition app sports a help or showcase file which is essentially an expandable CLV list which I adore (thanks, Erel) with BBlistviewitems (Klaus showed me how) inside.
So far no problem except when it comes to tables. Some cells are multiline, others use diffrent fonts etc.

Having not found anywhere a viable example, I created a workaround with labels for each cell in a row, placed on a canvas, took a snapshot and save the to disk like this:
Builds each complex table row:
   Q.xRow = Q.xRow+ 1
    Dim pnl As B4XView = xui.CreatePanel("")
    pnl.LoadLayout("Pane23")
    pnl.Width = maxWidth-Wmin
    pnl.Height = maxHeight
    Dim bmx As B4XBitmap = Pane22.Snapshot
    Dim Oname As String = $"xpx_${Q.nRow}"$
    Dim Ostream As OutputStream
    Ostream = File.OpenOutput(Q.tempPath, Oname, False)
    bmx.WriteToStream(Ostream, 100, "PNG")
    Ostream.Close
    Q.currentPnlPix = Oname
    Dim Out As String =$"[Alignment=Center][img dir=${Q.TempPath} FileName="${Oname}" width=${bmx.Width}/][/Alignment]"$
    Q.nRow=Q.nRow+1
    Return Out

This is quite cumbersome and takes a lot of time (1-2 seconds per table). Ideally I'd like to put the row BMX directly into an internal cache and use it in the bblistitem Out String ([View=... instead of [img dir=... and FileName=...).

But how, any ideas?

Thanks for your help,
john m.
 

Attachments

  • home-fries_DE.jpg
    home-fries_DE.jpg
    49.4 KB · Views: 14
Top