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:

stefanobusetto

Active Member
Licensed User
Longtime User
Check columns ( how-to )
B4X:
cc(2).Initialize2 ...
cc(2).RowIconTop  = 6dip 
cc(2).RowIconLeft = 6dip 
cc(2).setTypeCheck

the column will display a green tick if the value of the column is "1"
nothing otherwise

RowIconTop and RowIconLeft can be used to adjust
the position of the tick in the cell
:)
 
Last edited:

stefanobusetto

Active Member
Licensed User
Longtime User
@aviario

to setup a custom image for check columns
you can use an image column with a single value
cc(0).Initialize ...
cc(0).RowIconPut("1",bmp)
cc(0).SetTypeImage
anyway i'm adding the property for the image
and also the value

what do you mean for printing?

:)
 

aviario

Active Member
Licensed User
Longtime User
@aviario

to setup a custom image for check columns
you can use an image column with a single value
cc(0).Initialize ...
cc(0).RowIconPut("1",bmp)
cc(0).SetTypeImage
anyway i'm adding the property for the image
and also the value

what do you mean for printing?

:)

If you know of any library to print on printer

In the grid when the text of the column is larger than the width puts in two columns, there is the possibility to resize the height of that column automatically?
 

stefanobusetto

Active Member
Licensed User
Longtime User
No. I've developed an application that needs to print and i've decided to create pdfs. I've a good lib for that.

There is no autosize planned sorry.

:)
 

aviario

Active Member
Licensed User
Longtime User
Hi,
If i use Cgrid.ScrollTop, grid goes to first line, but can i select by code the first line?

Thanks
 

stefanobusetto

Active Member
Licensed User
Longtime User
Hi,
you can use SelectRow. I've exposed the method and posted version 2.05.
I've also added
- CheckIcon to set the icon
- CheckValue to set the "check" value
for the check columns
:)
 

stefanobusetto

Active Member
Licensed User
Longtime User
The RowHeight property allows to the the height of the rows.
I think you want to set instead the height of a given row.
Isn't it?
:)
 

jrat

Member
Licensed User
Longtime User
Whether it is possible to make FastScroll for big grids?
Like ListView1.FastScrollEnabled
 

stefanobusetto

Active Member
Licensed User
Longtime User
@magi6162
B4X:
Grid.Initialize("Grid")

Dim c(4) As xnGridCol
c(0).Initialize ( "Cod." , "cod" , 15%x )
c(1).Initialize ( "Des." , "des" , 60%x )
...

For i = 0 To c.Length - 1
    Grid.AppendCol ( c(i) )
Next

...

Dim ss As String
ss = "select cod , des , ... from ... " 

Grid.DeleteRows

Dim cc As Cursor
cc = Main.db.execquery ( ss & " limit 100 ")
Grid.CursorAppend ( cc )
 

stefanobusetto

Active Member
Licensed User
Longtime User
i use the grid with several devices
smartphones an tablets and
i've no problems with the grid lines
it could be the emulator (android version, display size, resolution, ...)
if you can supply some details on the vm
may be i can arrange some testing

as for the sorting i'm sorry
i thought i've already answered
i'm doing some test
to decide if add it or not

:)
 

stefanobusetto

Active Member
Licensed User
Longtime User
@magi6162
your code looks ok.
here attached the test program i use to debug the grid.
can you try if it works and if you can see the grid please?
the app creates a local database and loads the grid with
the CursorAppend method.
ciao
:)
 

Attachments

  • xnGridSample.zip
    13.2 KB · Views: 224

aviario

Active Member
Licensed User
Longtime User
hello, the version 2.07 has an error when I put
Cgrid.GridCreate2 (True) does not show the grid
Cgrid.GridCreate2 (False) works Ok.

When I put Cgrid.PropSetHeight (3.60) gives me the following error

LastException java.lang.indexOutOfBoundsException

Cgrid.PropSetHeight(3,60)
java.lang.IndexOutOfBoundsException
at java.util.LinkedList.get(LinkedList.java:519)
at it.csinet.xnObjects.xnGrid.PropSetHeight(xnGrid.java:830)
at it.csinet.xnObjects.b4aGrid.PropSetHeight(b4aGrid.java:433)
at flm.b4a.floatwindemo.stockcamion._configura_pantalla(stockcamion.java:1129)
at flm.b4a.floatwindemo.stockcamion._activity_create(stockcamion.java:347)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at flm.b4a.floatwindemo.stockcamion.afterFirstLayout(stockcamion.java:89)
at flm.b4a.floatwindemo.stockcamion.access$100(stockcamion.java:16)
at flm.b4a.floatwindemo.stockcamion$WaitForLayout.run(stockcamion.java:74)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4437)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:835)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)


thanks
 
Top