B4A Library Grid/Table and ListView Library

David Cochrane

Member
Licensed User
Longtime User
I have two-dimensional strings array...

SArr(32, 11) As String

and would like to create from that xnGrid with 11 columns and 32 rows.
There is no problem with 11 columns creation but how in a cycle to add all those rows?

For r = 1 To rows
gg.RowAppend(SArr(r)) 'doesn't work
Next
 

Carles Escudé

Member
Licensed User
Longtime User
Hello,

What if I need to change the row color depending on the value of the column 3 (in example)?

Many thanks!

[ EDIT ]

ok! I found the method DG_RowProps. But, as I said, I need the BackgroundColor property.

Do you know when will it arrive?

Thanks again!
 
Last edited:

BluSky76

Member
Licensed User
Longtime User
Hi Stefano,
it is possible, in the future, add a command to move the lines?

example:
gg.RowMove (CurrenteRow, NewRow)

Thanks
 

stefanobusetto

Active Member
Licensed User
Longtime User
@BluSky76

I dont think so
Sorry

I belive the grid must only display data
So you should, in my opinion, exchange the
underlying data and then refresh the grid
 

TheMightySwe

Active Member
Licensed User
Longtime User
Hello, I was wondering if it possible to get a a event on _CellRelease(Row As Int, Col As Int) So you can mark when you release the finger from the screen. Do you think that is possible?

//TMS
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hi Stefano,
you can delete only the selected rows from the grid?
Thanks

Here it is the code:

B4X:
Private grid As xnGrid
Sub grid_CellClick ( Col As Int, Row As Int )
grid.RowDelete(Row)
End Sub
 

BluSky76

Member
Licensed User
Longtime User
Thanks for the reply.

I do not want to delete a single line but with a command to delete all selected rows. If the grid contains 100 rows and 20 are selected I want to delete a command only the twenty selected.

example
grid.RowDeleteSelect

Thank you
 

Carles Escudé

Member
Licensed User
Longtime User
Hi!
Using xnGrid,
Is there the possibility to select a single cell instead of the full row?

Thanks!
 
Last edited:

Sberla

Active Member
Licensed User
Longtime User
Hello !
Is it possible to set the textcolor and of text size of columns instead of rows ?

Thanx
 

stefanobusetto

Active Member
Licensed User
Longtime User
Use the "CellProps" event


B4X:
Sub gg_CellProps ( aCol As Int , aRow As Int , aValue As String , aProps As xnGridCellProps )
If aCol = 1 Then
   aProps.TextColor = Colors.Red
   aProps.BackGroundColor = Colors.Gray
End If

If aCol = 1 Then
   If aRow = 1 Then
      aProps.BackGroundColor = Colors.Green
   End If
End If
End Sub
 

GaryK4

Member
Licensed User
Longtime User

I am new to this library. It looks very promising.
I created a test program and the CellProps event is giving a java error.
"java.lang.IllegalStateException: This method must only be called as part of a callback while a frame is in progress."

My phone is a new Note 8 - Android 7.1.1

What I am trying to accomplish is as follows,
When I long click a row or based on a db record, set that row to a color.
The original SetPropColor would have been perfect for my needs.

-----------------
I changed the program from GridCreate2(False) to GridCreate and the java error went away.
Now, I can get it to do what I want.
-----------------
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…