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:

robh

Member
Licensed User
Longtime User
it is a bug!!!
since you delete all rows then insert new ones
you can call GridCreate(...) to repaint
i'll fix the bug as soon as possible
thanks for the bug report
:)

a tip
if you go advanced
you can use the "#" button
to have the b4a code formatted
:D

No problem, glad I can be of help.
I also had the same problem with the .Clear method.
 

mrjaw

Active Member
Licensed User
Longtime User
I am trying to use the example but I get the error
B4X:
Compiling code.                         Error
Error parsing program.
Error description: Unknown type: xneditdate
Are you missing a library reference?
Occurred on line: 12
Dim edit_date1 As xnEditDate
 

robh

Member
Licensed User
Longtime User
Improvement

Hi Steffano,

Really good grid library, excellent stuff. Could I make a suggestion for a slight improvement, i don't know if this is possibly. The grid has a tendancy to want to scroll horizontal when attempting to scroll vertical. To achieve a vertical scroll it seems the user has to be very precise with vertical on screen touch. To improve this somewhat, could some code be introduced to analyze the the horizontal deviation on touch start and touch end and say if it's less than x number of pixels, assume the user wanted to vertically scroll?

Again, thanks for your efforts with this library, it's much appreciated.
 

Arun

Member
Licensed User
Longtime User
.isdate giving error in xnGridSample

I downloaded the xnGridSample.zip and xnObjects163.zip

I tried to run it using debug mode and got the following error

Compiling code. Error
Error compiling program.
Error description: Unknown member: isdate
Occurred on line: 298
If u.IsDate ( s , "dd-MM-yyyy" ) Then
Word: isdate

What am I doing wrong?

b4a ver 2.25
xnObjects lib is selected
Device is 7"tab running ICS

I am a noob so please assume that it is my error/oversight.

Thanking you in advance
 

stefanobusetto

Active Member
Licensed User
Longtime User
no pal
it's my mistake!
sorry, i've extended the lib
added some more functions and forgot to
update the example

try
B4X:
u.StringIsDate2(...)
 

Arun

Member
Licensed User
Longtime User
.isdate problem solved

I appreciate the prompt reply. It is working now.

Thanks for a great product.
 

StarinschiAndrei

Active Member
Licensed User
Longtime User
This library allows to create easely a grid.
Enjoy!
:)

Version 1.10
- row highlight even if no select sub is present
- xnTable now supports insert and delete
- xnTable now supports insert and append from map object

Version 1.15
- column gravity
- header text size and color
- rows text size and color for odd and even rows

Version 1.16
- added SelectedOddColor
- added SelectedEvenColor

Version 1.20
- added multiselection

Version 1.21
- added ability to enable horizontal scroll
- added ability to enable vertical scroll
- minor fixes

Version 1.30
- xnTable integrated in xnGrid
- added insert row
- added delete row
- added syncing between xnTable and xnGrid (SetValue)

Version 1.40
- added MapInsertRow/MapAppendRow
- added CursorInsertRow/CursorAppendRow
- added CursorInsert/CursorAppend
- added JsonInsert/JsonAppend

Version 1.46
- added SelectedCol

Version 1.48
- added TextColor
- Inverted parameters for MapInsertRow/CursorInsertRow
- Inverted parameters for CursorInsert/JsonInsert


see example code

Version 1.49
- added rows properties ( color : SetPropColor ( Row , Color ) )
- added long_select

Version 1.50
- added GetValue2/SetValue2 ( get and set values by field name )
- added long_select event

Version 1.51
- added bulk load capabilities (experimental)

Version 1.52
- added method SelectClear
- fixed a bug in BulkCursorAppend

Version 1.53
- added ScrollUp/Down

Version 1.61
- added support for grid lines (read specific post)
- GridWidth
- GridWidthHeaderOffset
- GridWidthCheckOffset
- GridWidthTextOffset
- added method GetColumn
- minor fixes
- updated sample code

Version 1.62
- added rows properties ( color : SetPropTextColor ( Row , Color ) )

Version 1.63
- added alternate coloring for groups of rows ( property ColumnColor )
rows are colored in groups using the OddColor/EvenColor
the color changes every time changes the value of the Column
specified in the ColumnColor property ( -1 means no group coloring )

If you like my grid.
You can support the development.



I wnted to try your grid but i got an error during compile
Compiling code. Error
Error compiling program.
Error description: Unknown member: isdate
Occurred on line: 298
If u.IsDate ( s , "dd-MM-yyyy" ) Then
Word: isdate

could you please tell me why ?

Thanks
 

pixelpop

Active Member
Licensed User
Longtime User
Where can I find the xnGridSample.zip that a previous poster referenced? Thanks!
 

stefanobusetto

Active Member
Licensed User
Longtime User
Have a look at the top post.
You can find it between the other zips. :)

Inviato dal mio GT-I9300 con Tapatalk 2
 
Last edited:

ibrikci

New Member
Licensed User
Longtime User
I got an error when compiling sample

Compiling code. 0.02
Compiling layouts code. 0.00
Generating R file. Error
AndroidManifest.xml:18: error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize').
 

stefanobusetto

Active Member
Licensed User
Longtime User
Sample code for xnObjDate

B4X:
Dim o As xnObjDate
Log ( o.IsNull )

o.FormatSql     = o.Format_YYYYMMDD
o.FormatDisplay = o.Format_YYYYMMDD_DOT

o.Value = DateTime.Now
Log ( o.ValueAsSql )
Log ( o.ValueAsDisplay )

o.Clear
Log ( o.IsNull )

o.ValueAsDisplay = "2012.12.12"
Log ( o.ValueAsSql )
Log ( o.ValueAsDisplay )

o.Clear
Log ( o.IsNull )

o.ValueAsSql = "20120101"
Log ( o.ValueAsSql )
Log ( o.ValueAsDisplay )

o.Clear
Log ( o.IsNull )

Log ( o.SetAsStringDisplay ( "dummy" ) )
Log ( o.SetAsStringDisplay ( "2012.12.12" ) )

Log ( o.SetAsStringSql ( "dummy" ) )
Log ( o.SetAsStringSql ( "20120101" ) )

Log ( o.SetAsStringSql ( "null" ) )
Log ( o.ValueAsSql )
Log ( o.ValueAsDisplay )

Log ( o.SetAsStringDisplay ( "..." ) )
Log ( o.ValueAsSql )
Log ( o.ValueAsDisplay )
 

androidvh

Member
Licensed User
Longtime User
AppendRow

Hallo I still have a question to the following syntax:


Dim Tr As TextReader
Dim kZeile As String
Dim aSpalten(col) As String col is a known index

Tr.Initialize(File.OpenInput(File.DirAssets, "demo.txt"))
kZeile = Tr.ReadLine
Do While kZeile <> Null
Dim fZeile() As String
If kZeile.Length > 0 Then
fZeile=Regex.Split(";", kZeile)
For i = 0 To col - 1
aSpalten(i) = fZeile(i)
Next
' Tabelle.AppendRow(Array As String(aSpalten)) line doesn´t work
Tabelle.AppendRow(Array As String(fZeile(0), fZeile(1), fZeile(2)....) this line work
End If
kZeile = Tr.ReadLine
Loop
Tr.Close

with Tabelle.AppendRow(Array As String(aSpalten)) the grid is empty
with Tabelle.AppendRow(Array As String(fZeile(0), fZeile(1),..etc. it´s ok

so what is wrong ?

kind regards Volker
 
Top