B4A Library Grid/Table and ListView Library

Discussion in 'Additional libraries, classes and official updates' started by stefanobusetto, Mar 28, 2012.

  1. imgsimonebiliato

    imgsimonebiliato Well-Known Member Licensed User

    Here it is the code:

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

    stefanobusetto Active Member Licensed User

    You can delete any row
     
  3. BluSky76

    BluSky76 Member Licensed 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
     
  4. Carles Escudé

    Carles Escudé Member Licensed User

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

    Thanks!
     
    Last edited: Nov 18, 2016
  5. stefanobusetto

    stefanobusetto Active Member Licensed User

    No
    I'm sorry
    :)
     
  6. Sberla

    Sberla Active Member Licensed User

    Hello !
    Is it possible to set the textcolor and of text size of columns instead of rows ?

    Thanx
     
  7. stefanobusetto

    stefanobusetto Active Member Licensed User

    Use the "CellProps" event
    :)

    Code:
    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
     
    DonManfred likes this.
  8. GaryK4

    GaryK4 Member Licensed 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: Oct 31, 2017
  9. magi6162

    magi6162 Well-Known Member Licensed User

    Sorry,
    could you list a list of all the grid events?

    thanks
     
  10. GaryK4

    GaryK4 Member Licensed User

    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.
     
  11. magi6162

    magi6162 Well-Known Member Licensed User

    thanks, I resolved
     
  12. Bladimir Silva Toro

    Bladimir Silva Toro Member Licensed User

    I really liked your Grid, I was trying I would like to know how vertical scroll bars are displayed?
     
  13. stefanobusetto

    stefanobusetto Active Member Licensed User

    The horizontal and vertical scroll bars are automatically display.
    You can enable the FastScroll option
    Code:
    Grid.FastScroll = True ;
    :)
     
  14. GaryK4

    GaryK4 Member Licensed 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?
     
  15. stefanobusetto

    stefanobusetto Active Member Licensed 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?
    :)
     
  16. GaryK4

    GaryK4 Member Licensed User

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

    stefanobusetto Active Member Licensed User

    Save the row when the user long click the cell
    then in the cellprops event
    if aRow = SavedRow then
    ....
    endif
     
  18. jrat

    jrat Member Licensed User

    how to set the color of a row based on the value of one column?
     
  19. imgsimonebiliato

    imgsimonebiliato Well-Known Member Licensed User

    Hi @jrat you need to implement this method:


    Code:
    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
     
  20. jrat

    jrat Member Licensed User

    Thanks it`s work
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice