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
    xnGridSample200beta.zip
    3.6 KB · Views: 2,737
  • xnGrid2xx_1.png
    xnGrid2xx_1.png
    77.2 KB · Views: 5,962
  • xnObjects267.zip
    xnObjects267.zip
    75.7 KB · Views: 1,494
  • xnObjects272.zip
    xnObjects272.zip
    87.2 KB · Views: 1,280
  • xnObjects273.zip
    xnObjects273.zip
    87.5 KB · Views: 1,368
  • xnObjects276.zip
    xnObjects276.zip
    87.2 KB · Views: 2,171
Last edited:
Hi

No doubt that the code is correct but how do you set a cell back color, because I am having trouble doing this.

Regards

David
 
With the same code that you wrote:

Code:
If aCol = 1 Then
  If aRow = 1 Then
  aProps.BackGroundColor = Colors.Green
  End if
End if

Maybe you haven't changed the word "gg" with the name of your xnGrid
 
Hi this is the code I am using 'TimeGrid' is the name of my grid

Code:
Dim props As xnGridCellProps

        TimeGrid_CellProps(2 , 1, "0", props)

    End If
End Sub

Sub TimeGrid_CellProps (aCol As Int , aRow As Int , aValue As String , aProps As xnGridCellProps )
    If aCol = 2 Then
           If aRow = 1 Then
             aProps.BackGroundColor = Colors.Red
           End If
    End If
End Sub
 
Try this please.

Code:
Sub <....>_CellProps ( aCol As Int , aRow As Int , aValue As String , aProps As xnGridCellProps )
If aCol = 1 Then
   aProps.BackGroundColor = Colors.Gray
End If

If aCol = 1 Then
   If aRow = 1 Then
      aProps.BackGroundColor = Colors.Green
   End If
End If
End Sub

The prevoius code sets the background color of the column 1 to Gray
and the background color of the column 1 of the row 2 to green
:)
 
Hi Stefano

I got it to work (sort of) as I did not expect the <...>_CellProps to trigger when I clicked on the grid, is that correct?.

I suppose I was looking for something like nameofgrid.cell(row,col).backcolor = colors.red, does that seem like it is something possible to do?

Regards

David
 
Hi again,

Is it possible to make a row visible but "disabled", so it does not respond to clicks or longclicks and looks slightly different?
 
There is no such built in feature.
But if you can create a list of disabled rows indexes and use
the On_CellProps event to custom color the row/cell.
And of course use the same list in the On_Click events
to take no action.
:)
 
Yes several times.
Should i have some requests i'll do it.
Sorting can be easely achieved using the events
already present in the grid.
:)
 
Thank you for the great grid. I can't seem to determine how to "hide" a row. Is this possible? If not can you make it possible? ;)
 
Hello stefanobusetto, when we can have this property for the versión 2.67

PropSetHeight property to change the height of the cells

Thank You
 
Back
Top