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,747
  • xnGrid2xx_1.png
    xnGrid2xx_1.png
    77.2 KB · Views: 5,971
  • xnObjects267.zip
    xnObjects267.zip
    75.7 KB · Views: 1,510
  • xnObjects272.zip
    xnObjects272.zip
    87.2 KB · Views: 1,294
  • xnObjects273.zip
    xnObjects273.zip
    87.5 KB · Views: 1,383
  • xnObjects276.zip
    xnObjects276.zip
    87.2 KB · Views: 2,185
Last edited:
Thanks a lot...
i´ll try that way ;)
 
Please help my find error.
I create SQL table
Code:
db.ExecNonQuery ("CREATE TABLE test (Id INTEGER PRIMARY KEY , parentId INTEGER,  Name TEXT, isFolder TEXT);")

Next i create Grid, the colums init use this code:
Code:
cur1 = db.ExecQuery ( "SELECT * FROM test" )
For col = 0 To NumberOfColumns - 1
    NameCol=cur1.GetColumnName(col)
    cc(col).Initialize2 (NameCol , NameCol , 100%x/NumberOfColumns , Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL )
    gg.ColAppend ( cc(col) )
Next
After them i want set same properties for rows
Code:
For r=0 To gg.RowCount-1
      If gg.GetValueSafe2(r , "isFolder")=1 Then
        gg.PropSetColor(r,Colors.Yellow)
        gg.PropSetTextColor(r,Colors.Black)
    End If
Next

Error:
If gg.GetValue2(r , "isFolder")=1 Then
java.lang.ArrayIndexOutOfBoundsException
 
I rename field
Code:
Main.db.ExecNonQuery ("CREATE TABLE test (Id INTEGER PRIMARY KEY , parentId INTEGER,  Name TEXT, ISFOLDER TEXT);")
and use
Code:
 If gg.GetValueSafe2(r , "ISFOLDER")=1 Then
and error is repeat

if i use
Code:
  Dim cc(5) As xnGridCol
  cc(0).Initialize2 ( "Id" , "Id" , 10%x , Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL )
  gg.ColAppend ( cc(0) )
  cc(1).Initialize2 ( "F" , "isFolder" , 0 , Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL )
  gg.ColAppend ( cc(1) )
  cc(2).Initialize2 ( "Op" , "Opened" , 0 , Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL )
  gg.ColAppend ( cc(2) )
  cc(3).Initialize2 ( "P" , "parentId" , 0 , Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL )
  gg.ColAppend ( cc(3) )
  cc(4).Initialize2 ( "Name" , "Name" , 90%x , Gravity.LEFT + Gravity.CENTER_HORIZONTAL )
  gg.ColAppend ( cc(4) )
all work fine
 
Hi Stefano,

I was wondering if you could add support for different typefaces? I would love to have a monospace font in the grid.
 
sample for a grid using the multiline row feature
:)

RelativeLayout reference
http://developer.android.com/reference/android/widget/RelativeLayout.html
Constants:
LEFT_OF = 0;
RIGHT_OF = 1;
ABOVE = 2;
BELOW = 3;
ALIGN_BASELINE = 4;
ALIGN_LEFT = 5;
ALIGN_TOP = 6;
ALIGN_RIGHT = 7;
ALIGN_BOTTOM = 8;
ALIGN_PARENT_LEFT = 9;
ALIGN_PARENT_TOP = 10;
ALIGN_PARENT_RIGHT = 11;
ALIGN_PARENT_BOTTOM = 12;
CENTER_IN_PARENT = 13;
CENTER_HORIZONTAL = 14;
CENTER_VERTICAL = 15;
 

Attachments

  • xnGridSample4.png
    xnGridSample4.png
    43.2 KB · Views: 1,115
  • xnGridSample4.zip
    xnGridSample4.zip
    13.7 KB · Views: 788
  • xnGridSample4_layout.png
    xnGridSample4_layout.png
    60.1 KB · Views: 965
Last edited:
Hello stefanobusetto, when you scroll the grid horizontally have any event to detect it?

un saludo
Paco
 
And the "LongClick" event on a line or cell would be very useful. :p

Sorry for all the ideas, you have done a very fine job with this grid.
 
@TheMightySwe
hi
- i don't think i'm going to add a tag for every row of the grid in a short time
i'll add your request to the wishlist
- every request is welcome
the longclick event is already present
:)
 
Back
Top