L LucianoB Member Licensed User Longtime User Jan 24, 2023 #1 Hi all, I have a table of 10 columns and its cells are filled by imageviews. I'd like to improve the row construction in order to have less or more columns dinamically. So if I change the size of the form the number of columns changes too. Is that possible? Thank you B4X: Copy Sub AddPics Dim iv(10) As ImageView tbl_Settings Dim row() As Object = CreateRow(Array As ImageView(iv(0),iv(1),iv(2),iv(3),iv(4),iv(5),iv(6),iv(7),iv(8),iv(9))) tv1.Items.Add(row) End Sub B4X: Copy Sub CreateRow(Row() As Object) As Object() Dim ivs(Row.Length) As Object For i = 0 To Row.Length - 1 If i <= countpics-1 Then Dim iv As ImageView Dim images(10) As Image iv.Initialize("") iv.SetSize (80dip,80dip) images(i).Initialize(mediapath,pics.Get(i)) iv.SetImage(images(i)) ivs(i) = iv Else Dim lbl As Label 'Add label in the case lbl.Initialize("") 'pictures are less than ivs(i) = lbl 'imageviews End If Next Return ivs End Sub
Hi all, I have a table of 10 columns and its cells are filled by imageviews. I'd like to improve the row construction in order to have less or more columns dinamically. So if I change the size of the form the number of columns changes too. Is that possible? Thank you B4X: Copy Sub AddPics Dim iv(10) As ImageView tbl_Settings Dim row() As Object = CreateRow(Array As ImageView(iv(0),iv(1),iv(2),iv(3),iv(4),iv(5),iv(6),iv(7),iv(8),iv(9))) tv1.Items.Add(row) End Sub B4X: Copy Sub CreateRow(Row() As Object) As Object() Dim ivs(Row.Length) As Object For i = 0 To Row.Length - 1 If i <= countpics-1 Then Dim iv As ImageView Dim images(10) As Image iv.Initialize("") iv.SetSize (80dip,80dip) images(i).Initialize(mediapath,pics.Get(i)) iv.SetImage(images(i)) ivs(i) = iv Else Dim lbl As Label 'Add label in the case lbl.Initialize("") 'pictures are less than ivs(i) = lbl 'imageviews End If Next Return ivs End Sub
teddybear Well-Known Member Licensed User Jan 24, 2023 #2 You may use a list as columns? Last edited: Jan 24, 2023 Upvote 0
teddybear Well-Known Member Licensed User Jan 24, 2023 #4 I mean you may add the iv(0)...iv(n) into a list, n is variable. and then put a list reference on each row. Last edited: Jan 24, 2023 Upvote 0
I mean you may add the iv(0)...iv(n) into a list, n is variable. and then put a list reference on each row.