B4A Library Grid/Table and ListView Library

This library allows to create easely grids/tables and
from version 2.50
list views too!
Enjoy!
:)

The original post has been moved
http://www.b4x.com/android/forum/threads/grid-library.16381/page-10#post-168452"

Version 2.50 beta
- Added support for multiline rows

Version 2.51 beta
- Bug fixes

Version 2.52 beta
- Added Typeface support for rows and hedaer

Version 2.53
- Added SingleLine property for columns

sample code and usage hints can be found here
http://www.b4x.com/android/forum/threads/grid-library.16381/page-15#post-194602

Version 2.55
- Added object b4aActivityContext

Version 2.56
- Added and modified event hendlers
https://www.b4x.com/android/forum/threads/grid-and-listview-library.16381/page-19#post-297198

Version 2.57
- Added Columns Builders
https://www.b4x.com/android/forum/threads/grid-and-listview-library.16381/page-19#post-299406

Version 2.58
- Bug fixes

Version 2.59
- Added RowHeight for each column
- Added HeaderHeight for each column
https://www.b4x.com/android/forum/threads/grid-and-listview-library.16381/page-19#post-304465

Version 2.60
- Added TouchX() and TouchY()
- Added FirstVisiblePosition() and LastVisiblePosition()
https://www.b4x.com/android/forum/threads/grid-and-listview-library.16381/page-19#post-304905

Version 2.65
- Added Button Columns
https://www.b4x.com/android/forum/threads/grid-and-listview-library.16381/page-19#post-306507

Version 2.67
- Added CellProps event
- Removed PropSetColor / PropSetTextColor
https://www.b4x.com/android/forum/threads/grid-table-and-listview-library.16381/page-19#post-307490

Version 2.71
- Added OnSelectAllow event
- Added selection on row background
https://www.b4x.com/android/forum/threads/grid-table-and-listview-library.16381/page-21#post-347618

Version 2.73
- Added OnRowProps event
https://www.b4x.com/android/forum/threads/grid-table-and-listview-library.16381/page-21#post-349404

Version 2.76
- Fixed dubug log bug
https://www.b4x.com/android/forum/threads/grid-table-and-listview-library.16381/page-21#post-375965

If you like my grid.
You can support the development.


 

Attachments

  • xnGridSample200beta.zip
    3.6 KB · Views: 2,175
  • xnGrid2xx_1.png
    xnGrid2xx_1.png
    77.2 KB · Views: 5,283
  • xnObjects267.zip
    75.7 KB · Views: 917
  • xnObjects272.zip
    87.2 KB · Views: 700
  • xnObjects273.zip
    87.5 KB · Views: 790
  • xnObjects276.zip
    87.2 KB · Views: 1,562
Last edited:

aviario

Active Member
Licensed User
Longtime User
Stefanobusetto Hello, I installed the latest version 2.50, and I encounter the following problem, as you can see in the two images that attached on the right side of the grid with 2.50 do not fit the vertical line

Code
If Cgrid.IsInitialized = False Then
Cgrid.Initialize("Cgrid")

Cgrid.RowHeight = 30dip
Cgrid.HeaderColor = Colors.Gray
Cgrid.RowEvenColor = Colors.White
Cgrid.RowOddColor = Colors.RGB(192,255,192)
Cgrid.GridColor=Colors.Black
Cgrid.HeaderHeight = 30dip

Cgrid.HeaderTextSize = 13
Cgrid.RowTextSize = 13
Cgrid.HeaderTextColor = Colors.Black
Cgrid.RowTextColor = Colors.Black
Cgrid.SelectedOddColor = Colors.RGB(192,192,255)
Cgrid.SelectedEvenColor = Colors.RGB(192,192,255)


NomColu1="Documento": LonColu1=100dip
NomColu2="Número": LonColu2=100dip
NomColu3="Importe": LonColu3=100dip


Dim cc(3) As xnGridCol

cc(0).Initialize2 ( NomColu1 , "Campo1" , LonColu1 , Gravity.LEFT+Gravity.CENTER_VERTICAL)
cc(0).HeaderGravity = Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
Cgrid.ColAppend ( cc(0) )
cc(1).Initialize2 ( NomColu2 , "Campo2" , LonColu2 , Gravity.CENTER+Gravity.CENTER_VERTICAL )
cc(1).HeaderGravity = Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
Cgrid.ColAppend ( cc(1) )
cc(2).Initialize2 ( NomColu3 , "Campo3" , LonColu3 , Gravity.RIGHT+Gravity.CENTER_VERTICAL )
cc(2).HeaderGravity = Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL
Cgrid.ColAppend ( cc(2) )

MiPanel.AddView(Cgrid,4dip,Nomcli.Top+Nomcli.Height+5dip,LonColu1+LonColu2+LonColu3,92%y)
Cgrid.GridWidth = 1dip

Cgrid.GridCreate2 (False )
End If
 

Attachments

  • grid2.25.jpg
    grid2.25.jpg
    29.7 KB · Views: 391
  • grid2.50.jpg
    grid2.50.jpg
    31.2 KB · Views: 361

stefanobusetto

Active Member
Licensed User
Longtime User
@aviario
B4X:
Cgrid.ScrollWidth = 5dip
Cgrid.TransparentColor = Colors.Black
Activity.AddView(Cgrid,4dip,5dip,LonColu1+LonColu2+LonColu3+Cgrid.ScrollWidth,92%y)

update to grid 2.51
:)
 

stefanobusetto

Active Member
Licensed User
Longtime User
It works in the same way the Click event
but it si fired when the row si clicked for a while.
There is a sample in the xnGridSample.zip.
If you need i can post another example.
:):)
 

TheMightySwe

Active Member
Licensed User
Longtime User
Aha, i did not have a underscore in long_select

B4X:
Sub gg_long_select
If gg.Multiselect = False Then
  Msgbox ( "LONG : value of the first column = " & gg.GetValue  ( gg.RowSelected , 0    ) , "row selected = " & gg.RowSelected )
  Msgbox ( "LONG : value of the first column = " & gg.GetValue2 ( gg.RowSelected , "cod" ) , "row selected = " & gg.RowSelected )
End If
End Sub
 

TheMightySwe

Active Member
Licensed User
Longtime User
Can you post an example for LongSelect, the one in the file does not work in my project.
 
Last edited:

qsrtech

Active Member
Licensed User
Longtime User
Hi, how do you make an Icon in the grid "fill" such that it fills the entire width/height of the col/row?
 

stefanobusetto

Active Member
Licensed User
Longtime User
you can have icons of the size you like
then you can fine tune the position of the icons in the cells
with the properties
HeaderIconLeft / HeaderIconTop
RowIconLeft / RowIconTop
:)
 

aviario

Active Member
Licensed User
Longtime User
Hello stefanobusetto, long ago when you ask whether the horizontal grid moves have to detect any case, is there any possibility?

Un saludo
Paco
 

stefanobusetto

Active Member
Licensed User
Longtime User
Hola Paco nice to hear you.

I think it can be done (i've found some hints on how i can handle it).
The problem is i've very few time so i'm only fixing the bugs to the lib.
Stefano
 

qsrtech

Active Member
Licensed User
Longtime User
stefanobusetto said:
you can have icons of the size you like
is then you can fine tune the position of the icons in the cells
with the properties
HeaderIconLeft / HeaderIconTop
RowIconLeft / RowIconTop
:)
Thanks for the reply. But just to confirm, The grid doesn't resize the icon to fit?

Also, Is there a way to control the grid from trying to do multiline when the text is longer than the cell?
 

stefanobusetto

Active Member
Licensed User
Longtime User
That's correct. There is no icon auto resize.
There is no way to prevent text wrapping too.
As for this second feature i'll check if can be added.
:)
 

aviario

Active Member
Licensed User
Longtime User
Thanks for the answer, if we are lucky to have and hold some time to do

un saludo
Paco
 

aviario

Active Member
Licensed User
Longtime User
Also, Is there a way to control the grid from trying to do multiline when the text is longer than the cell?[/quote]

Hello, I can control the length of the text and what I do is to the highest line of the Grid

un saludo
Paco
 

stefanobusetto

Active Member
Licensed User
Longtime User
Also, Is there a way to control the grid from trying to do multiline when the text is longer than the cell?

Hello, I can control the length of the text and what I do is to the highest line of the Grid

un saludo
Paco[/quote]
sorry
i've missed this last one
i've received no notification
i'll have a look
 

stefanobusetto

Active Member
Licensed User
Longtime User
@Paco
Added SingleLine property for columns
B4X:
cc(1).SingleLine = True
If set to true text ( wider the the cell ) is kept in one line
otherwise text is splitted in more lines
:)
 
Top