Jump to content
BennieC

Listview Programming

Recommended Posts

Good day

I am trying to build an application which requires me to display multiple images in groups with selectable sizes.  The images consist of a bitmap and a text field.  My idea is to put the image groups in a TListview (Which I hope can display horizontally) and then add these listview groups into a TFlowlayout to manage the screen layout.

However, I simply do not get it right to create a TListview item programmatically to display the image.  I have tried to create a TListItemImage as well as simply adding a TListViewItem but neither worked in that I could see anything on the screen.

I am including my test code (Note it pulls images from a folder for testing).  The commented out sections will probably indicate some of the experiments that I tried.

 

I will probably also struggle to add the TListviews to the TFlowlayout.  Some advice will be much appreciated.  The idea is that the application will run on both Android mobile as well as desktops.

prjFlowLO.dpr

prjFlowLO.dproj

uFlowLOMain.fmx

uFlowLOMain.pas

Share this post


Link to post

Hi,

 

2 solutions.

First one is to use a TListView and Dynamic appearance, like this (listview "livebinded" to fdmemtable)

image.thumb.png.647fca0b60a6f3cb7fcc13aae0475e4e.png

In this case, it could be easy to manage groups.

pro : if data is in a Table, it's easy to fill with livebindings and easy to manage groups

con : if you want different size (possible) you have to code 

 

Second one is to use a TScollbox and a TFrame (same design as Item).

 pro  : It's easy to resize a TFrame.  In this case, Headergroup should certainly be another frame.
 con :  All is to code


Depending of solution you choose, I will explain more if needed

Edited by Serge_G
  • Like 1

Share this post


Link to post
15 hours ago, BennieC said:

TListview item programmatically to display the image.

Does it mean you want to create at runtime everything? Without using Live bindings?

 

If you want to separately manage Types, Front-End, Back-End.

Check the zip file at the bottom.

 

 

Edited by skyzoframe[hun]

Share this post


Link to post

So I suggest you to use Frames and a ScrollBox (or VertScrollBox or HorzScrollBox)

 

Here my "french" way to do it.

But I remember also a some videos of CodeRage 2019 #13

 

Edited by Serge_G
  • Like 1

Share this post


Link to post

I have now used frames and a vertscrollbox and indeed it works well.   (Even struggled through the French way of doing it)  I would like to use a flow layout and have inserted that into the scrollbox.  This seems to work better than me calculating object position as I would have to do in the scrollbox.  I do however have a problem with the flowlayout when anchored to the right of the scrollbox and have posted a separate question on that.

Share this post


Link to post
55 minutes ago, BennieC said:

Even struggled through the French way of doing it

:classic_biggrin:

56 minutes ago, BennieC said:

I do however have a problem with the flowlayout when anchored

When I use ScrollBox and Frames, I never use anchors, preferring to calculate positions of each frame. 

Why ? I remember a video of a Brazilian guy demonstrating that this way was minus time-consuming  

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×