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,180
  • xnGrid2xx_1.png
    xnGrid2xx_1.png
    77.2 KB · Views: 5,297
  • xnObjects267.zip
    75.7 KB · Views: 923
  • xnObjects272.zip
    87.2 KB · Views: 706
  • xnObjects273.zip
    87.5 KB · Views: 794
  • xnObjects276.zip
    87.2 KB · Views: 1,570
Last edited:

GaryK4

Member
Licensed User
Longtime User
Sorry,
could you list a list of all the grid events?

thanks

Hi,

I am just in the evaluation process. The current events are select, long_select and CellProps.

As I said in my edited message, I got the program to work.
GridCreate2(False) was creating a java error.
GridCreate works!

I'm not sure what the difference is, but I will go with what is working.
 

stefanobusetto

Active Member
Licensed User
Longtime User
The horizontal and vertical scroll bars are automatically display.
You can enable the FastScroll option
B4X:
Grid.FastScroll = True ;
:)
 

GaryK4

Member
Licensed User
Longtime User
I added the following code to the provided sample program.

Sub gg_CellProps ( aCol As Int , aRow As Int , aValue As String , aProps As xnGridCellProps )
Log (aCol & " - " & aRow)
End Sub

There are 3 rows with 4 columns.
When I touch a cell, It lists all rows and columns. Not just the one that I selected?

Am I doing something wrong?
 

stefanobusetto

Active Member
Licensed User
Longtime User
The CellProps is called every time a cell is painted.
You can set the cell properties assigning vaules to the aProps object.
The aCol , aRow and aValue are passed to provide information on the
painting cell.
What do you want to do?
:)
 

GaryK4

Member
Licensed User
Longtime User
The CellProps is called every time a cell is painted.
You can set the cell properties assigning vaules to the aProps object.
The aCol , aRow and aValue are passed to provide information on the
painting cell.
What do you want to do?
:)

I want to long click on a cell and change it value and background color. Basically, a toggle column.
 

stefanobusetto

Active Member
Licensed User
Longtime User
Save the row when the user long click the cell
then in the cellprops event
if aRow = SavedRow then
....
endif
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
how to set the color of a row based on the value of one column?

Hi @jrat you need to implement this method:


B4X:
Dim grid as xnGrid

Sub grid_CellProps ( aCol As Int, aRow As Int, aValue As String, aProps As xnGridCellProps )
Dim v As String
v = grid.GetValue2 ( aRow, "VALUE" )

If v = "0" Then aProps.BackGroundColor = Colors.Red
If v = "1" Then aProps.BackGroundColor = Colors.Green

End Sub
 

laguilar

Member
Licensed User
Longtime User
What reason would the grid appear, but not the rows, only the headers? The row count is > 0 when I look at it in the watch window and the call to RowAppend returns a boolean value of true. I noticed that if I move the focus to a EditText box that is on the screen, then the rows become visible. I've tried calling .Invalidate on the parent panel that the grid is inside of, and I've tried calling the GridRepaint, still no affect. Any ideas?
 

MarkusR

Well-Known Member
Licensed User
Longtime User
What reason would the grid appear, but not the rows, only the headers? The row count is > 0 when I look at it in the watch window and the call to RowAppend returns a boolean value of true. I noticed that if I move the focus to a EditText box that is on the screen, then the rows become visible. I've tried calling .Invalidate on the parent panel that the grid is inside of, and I've tried calling the GridRepaint, still no affect. Any ideas?

try to reproduce it in a new project and if the problem is still there export the project from ide and open a new question with attachment.
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
What reason would the grid appear, but not the rows, only the headers? The row count is > 0 when I look at it in the watch window and the call to RowAppend returns a boolean value of true. I noticed that if I move the focus to a EditText box that is on the screen, then the rows become visible. I've tried calling .Invalidate on the parent panel that the grid is inside of, and I've tried calling the GridRepaint, still no affect. Any ideas?
Have you called?
B4X:
aGrid.GridCreate
 

Bladimir Silva Toro

Active Member
Licensed User
Longtime User
Dear colleagues

I have been using this library since 2015 in my B4A projects.

I need to be able to create a column that is invisible to the user.

This is my code to create the column:

cc(0).Initialize2 ( "Cod" , "codb" , 50dip , Gravity.CENTER_VERTICAL + Gravity.CENTER_HORIZONTAL)
gg.ColAppend ( cc(0) )

I can't make it invisible to the user.

I thank you in advance for your valuable collaboration.
 
Top