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,739
  • xnGrid2xx_1.png
    xnGrid2xx_1.png
    77.2 KB · Views: 5,964
  • xnObjects267.zip
    xnObjects267.zip
    75.7 KB · Views: 1,500
  • xnObjects272.zip
    xnObjects272.zip
    87.2 KB · Views: 1,282
  • xnObjects273.zip
    xnObjects273.zip
    87.5 KB · Views: 1,370
  • xnObjects276.zip
    xnObjects276.zip
    87.2 KB · Views: 2,173
Last edited:
I have two-dimensional strings array...

SArr(32, 11) As String

and would like to create from that xnGrid with 11 columns and 32 rows.
There is no problem with 11 columns creation but how in a cycle to add all those rows?

For r = 1 To rows
gg.RowAppend(SArr(r)) 'doesn't work
Next
 
Hello,

What if I need to change the row color depending on the value of the column 3 (in example)?

Many thanks!

[ EDIT ]

ok! I found the method DG_RowProps. But, as I said, I need the BackgroundColor property.

Do you know when will it arrive?

Thanks again!
 
Last edited:
Hi Stefano,
it is possible, in the future, add a command to move the lines?

example:
gg.RowMove (CurrenteRow, NewRow)

Thanks
 
@BluSky76

I dont think so
Sorry

I belive the grid must only display data
So you should, in my opinion, exchange the
underlying data and then refresh the grid
:)
 
Hello, I was wondering if it possible to get a a event on _CellRelease(Row As Int, Col As Int) So you can mark when you release the finger from the screen. Do you think that is possible?

//TMS
 
Hi Stefano,
you can delete only the selected rows from the grid?
Thanks

Here it is the code:

Code:
Private grid As xnGrid
Sub grid_CellClick ( Col As Int, Row As Int )
grid.RowDelete(Row)
End Sub
 
Thanks for the reply.

I do not want to delete a single line but with a command to delete all selected rows. If the grid contains 100 rows and 20 are selected I want to delete a command only the twenty selected.

example
grid.RowDeleteSelect

Thank you
 
Hi!
Using xnGrid,
Is there the possibility to select a single cell instead of the full row?

Thanks!
 
Last edited:
Hello !
Is it possible to set the textcolor and of text size of columns instead of rows ?

Thanx
 
Use the "CellProps" event
:)

Code:
Sub gg_CellProps ( aCol As Int , aRow As Int , aValue As String , aProps As xnGridCellProps )
If aCol = 1 Then
   aProps.TextColor = Colors.Red
   aProps.BackGroundColor = Colors.Gray
End If

If aCol = 1 Then
   If aRow = 1 Then
      aProps.BackGroundColor = Colors.Green
   End If
End If
End Sub
 
Use the "CellProps" event
:)

Code:
Sub gg_CellProps ( aCol As Int , aRow As Int , aValue As String , aProps As xnGridCellProps )
If aCol = 1 Then
   aProps.TextColor = Colors.Red
   aProps.BackGroundColor = Colors.Gray
End If

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

I am new to this library. It looks very promising.
I created a test program and the CellProps event is giving a java error.
"java.lang.IllegalStateException: This method must only be called as part of a callback while a frame is in progress."

My phone is a new Note 8 - Android 7.1.1

What I am trying to accomplish is as follows,
When I long click a row or based on a db record, set that row to a color.
The original SetPropColor would have been perfect for my needs.

-----------------
I changed the program from GridCreate2(False) to GridCreate and the java error went away.
Now, I can get it to do what I want.
-----------------
 
Last edited:
Back
Top