B4A Library Grid/Table and ListView Library

Descartex

Well-Known Member
Licensed User
Longtime User
Thanks a lot...
i´ll try that way
 

jrat

Member
Licensed User
Longtime User
Please help my find error.
I create SQL table
B4X:
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:
B4X:
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
B4X:
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
 

jrat

Member
Licensed User
Longtime User
I rename field
B4X:
Main.db.ExecNonQuery ("CREATE TABLE test (Id INTEGER PRIMARY KEY , parentId INTEGER,  Name TEXT, ISFOLDER TEXT);")
and use
B4X:
 If gg.GetValueSafe2(r , "ISFOLDER")=1 Then
and error is repeat

if i use
B4X:
  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
 

TheMightySwe

Active Member
Licensed User
Longtime User
Hi Stefano,

I was wondering if you could add support for different typefaces? I would love to have a monospace font in the grid.
 

stefanobusetto

Active Member
Licensed User
Longtime User
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
    43.2 KB · Views: 630
  • xnGridSample4.zip
    13.7 KB · Views: 478
  • xnGridSample4_layout.png
    60.1 KB · Views: 538
Last edited:

stefanobusetto

Active Member
Licensed User
Longtime User
@TheMightySwe
yes
you can add one or more zero width columns to the grid
and you'll be able to store the values you need
zero width columns are not visible
 

aviario

Active Member
Licensed User
Longtime User
Hello stefanobusetto, when you scroll the grid horizontally have any event to detect it?

un saludo
Paco
 

TheMightySwe

Active Member
Licensed User
Longtime User
And the "LongClick" event on a line or cell would be very useful.

Sorry for all the ideas, you have done a very fine job with this grid.
 

stefanobusetto

Active Member
Licensed User
Longtime User
@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
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…