B4A Library [Class] Flexible Table

Discussion in 'Additional libraries, classes and official updates' started by melamoud, Jun 30, 2013.

  1. Erel

    Erel Administrator Staff Member Licensed User

    About this code:
    Code:
    Public Sub JumpToRowAndSelect(Row As Int, Col As Int)
        
    Dim rc As RowCol
     
        rc.Row = Row
        rc.Col = Col
        SelectRow(rc)
        Sleep(
    0)

        SV.VerticalScrollPosition = Row * cRowHeight
        
    Private i, Left As Int
        
    If Col > 0 Then
            
    For i = 0 To Col - 1
                Left = Left + ColumnWidths(i)       
            
    Next
        
    End If
        SV.HorizontalScrollPosition = Left
    End Sub
    If you want to call it and wait for it to complete before continuing (like with DoEvents) then you need to return ResumableSub and call it with Wait For (...) Complete (Unused As Boolean).
     
  2. klaus

    klaus Expert Licensed User

    I finally leave it in with a comment.
     
    Erel likes this.
  3. Johan Hormaza

    Johan Hormaza Active Member Licensed User

    How can I add buttons to a cell?
    Thank you!

    Johan
     
  4. klaus

    klaus Expert Licensed User

    All cells in the Flexible Table are Labels, you cannot add any other kind of views.
     
    Johan Hormaza likes this.
  5. klaus

    klaus Expert Licensed User

    The Table class has been updated to version 2.29 in the first post.

    EDIT: 2018.04.11 Version 2.29
    Version 2.27
    set the two variables sortedCol and sortingDir to Public instaed of Private
    added RemoveAccent routine for sorting with accented characters
    Version 2.28
    Added SetHeaderTypeFaces
    Added SortRemoveAccents property
    Version 2.29
    Added SaveTableToCSV2 with a user defined separator character
     
    Erel and vecino like this.
  6. vecino

    vecino Well-Known Member Licensed User

    Hello, is it possible to change the color of the text and the background of one or more columns?
    I think it does not work: SetTextColors, neither SetColumnColors
    Code:
    Dim iColorFore As Int = Colors.Red
    Dim iColorBack As Int = Colors.Blue
    Dim iColorOtro As Int = Colors.Green
    tbLotes.SetTextColors(
    Array As Int(iColorFore,iColorFore,iColorFore,iColorFore,iColorFore,iColorOtro,iColorOtro))
    tbLotes.SetColumnColors(
    Array As Int(iColorBack,iColorBack,iColorBack,iColorBack,iColorBack,iColorFore,iColorFore))
     
  7. klaus

    klaus Expert Licensed User

    I will have a look at it.
     
    José J. Aguilar and vecino like this.
  8. vecino

    vecino Well-Known Member Licensed User

    Thank you!!!
     
  9. klaus

    klaus Expert Licensed User

    This code works in the demo project.
    Code:
    Table2.LoadSQLiteDB(Starter.SQL1, "SELECT * FROM persons"True)
    Dim iColorFore As Int = Colors.Red
    Dim iColorBack As Int = Colors.Blue
    Dim iColorOtro As Int = Colors.Green
    Table2.SetTextColors(
    Array As Int(iColorFore,iColorFore,iColorFore,iColorFore,iColorOtro,iColorOtro))
    Table2.SetColumnColors(
    Array As Int(iColorBack,iColorBack,iColorBack,iColorBack,iColorFore,iColorFore))
    Table2.UseColumnColors = 
    True
    Table2.LoadSQLiteDB(Starter.SQL1, 
    "SELECT * FROM persons"True)
    The first LoadSQLiteDB makes sure that the NumberOfColumns is known.
    Then, define the colors.
    Then, you must set UseColumnColors = True !
    Then, reload the table.
     
    Johan Hormaza and vecino like this.
  10. vecino

    vecino Well-Known Member Licensed User

    Hi, I was missing that line.
    Thank you.
     
  11. vecino

    vecino Well-Known Member Licensed User

    Hello, is there any configuration that does not show colors for lines, selected, etc.?
    That is, the whole background is white and the black letters, for example.
    And that does not change color when pressing anything.
     
  12. vecino

    vecino Well-Known Member Licensed User

    I already found out.
    It's simple, I assign the colors you want.
    Regards.
     
  13. AHilberink

    AHilberink Active Member Licensed User

    Hi,

    I need to wrap a long line. Automatic wrap only makes a second line. Is there a way to generate more? Now the line is cutting. I tried to exceed the Rowheight, but this did not help.

    B4A v8.80 and Table v2.29

    Best regards,
    André
     
  14. klaus

    klaus Expert Licensed User

    You have to increase the RowHeight and:
    and set Table1.SingleLine = False.
     
  15. AHilberink

    AHilberink Active Member Licensed User

    Hi Klaus,

    When do I set these? I have add by CustomView and this code:
    Code:
    HerTabel.LoadSQLiteDB(Main.SQL1,"SELECT Naam, Beschrijving FROM Table WHERE ProjectID='1'",False)
        HerTabel.RowHeight=
    100dip
        HerTabel.SingleLine=
    False
        HerTabel.SetColumnsWidths(
    Array As Int(100dip,400dip))
    Both RowHeight and SingleLine has no effect. Only edit the Table.bas cSingeline=False is working, but still max 2 and cutting.

    Can you tell me what I do wrong?

    Best regards,
    André
     
  16. klaus

    klaus Expert Licensed User

    This code should work.
    Code:
    HerTabel.RowHeight=100dip
    HerTabel.SingleLine=
    False
    HerTabel.LoadSQLiteDB(Main.SQL1,
    "SELECT Naam, Beschrijving FROM Table WHERE ProjectID='1'",False)
    HerTabel.SetColumnsWidths(
    Array As Int(100dip,400dip))
     
    Johan Hormaza likes this.
  17. klaus

    klaus Expert Licensed User

    The Table has been updated to Version 3.00 in the first post.

    Amended SetColumnColors and SetTextColors
    Removed Reflection library dependency
     
    Last edited: Apr 25, 2019
    Erel, DonManfred and vecino like this.
  18. fishwolf

    fishwolf Active Member Licensed User

    Is it possible set fixed colomns?

    for example, the firts column is always visible also with horizonal scrolling, scrilling only other colunms

    Thanks
     
  19. LucaMs

    LucaMs Expert Licensed User

    I think it's not possible, since the table is based on a ScrollView2D.
     
  20. LucaMs

    LucaMs Expert Licensed User

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