B4J Question [B4X] CustomListView with X Columns based on width of Form/Screen ?

Magma

Expert
Licensed User
Longtime User
Let's say for example we have a card (a layout like this):
card1.jpg

a pane... with some labels... may be a an image too....

Is there something (CustomListView) ready to use or I must create it... to show many layouts with X Columns based on width of Form/Screen ?

1647942071342.png


or if it is bigger form... screen:
1647942107002.png


I know that i can may be create 2,3,4 different layouts with 2,3,4 panes and labels...
but thought may be there is a ready routine for customlistview making that...

or not ? :)

is there a ready lib/snippet .. that can i use... ? thanks
 

Magma

Expert
Licensed User
Longtime User
1647972327425.png


... It's a bit slow with loading layout everytime and various controls into it... but ofcourse doing the job...

adding an example with loading layout.... for anyone want to use it like this

Hmmm I am thinking, add arrows for changing pages (because i want to use it for showing records from databases like different view <> b4xtable)... or something like lazy loading... like customview... but I am on thinking...

ps: have in mind that using scrollpane was original idea by: stevel05 here - so thanks/like must go to stevel05
 

Attachments

  • Scrollpanelayout-magma.zip
    38.6 KB · Views: 191
Last edited:
Upvote 0

stevel05

Expert
Licensed User
Longtime User
It is considerably quicker if you don't load a layout.

File removed, see post #27
 
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I don't know why the first answer was not enough:
Send me one of the many credit cards you have, together with the code to use it, without spending limit and I'll write you how to do it ?

(create the item at runtime)
  1. on MainForm_Resize
  2. (CLV anchored)
  3. clear CLV
  4. create a panel (pnlItem) as large as the CLV
  5. calculate how many cards (CardsPerRow) can fit (horizontally)
  6. create CardsPerRow cards (panels) and add them to pnlItem
  7. add pnlItem to CLV.
Of course, you should also calculate how many pnlItem (items) would be needed.
 
Last edited:
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
a little more complex (as we said) as you must add also an extra pnlitem per row
It is the usual way to create items for CLVs, as per your initial question, with the difference that it is usually more convenient to load a layout into the panel.

Being a CLV you also have other advantages of this View, of course, such as the item-row index (but maybe you won't need this).
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
the attached file has the same files with that i ve already uploaded (or not?)... did you want to upload something different ?
Yes I meant to upload this one.
 

Attachments

  • Scrollpanelayout2.zip
    38.9 KB · Views: 174
Upvote 0
Top