B4A Library [Class] Flexible Table

Erel

B4X founder
Staff member
Licensed User
Longtime User
About this code:
B4X:
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).
 

klaus

Expert
Licensed User
Longtime 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
 

vecino

Well-Known Member
Licensed User
Longtime 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
B4X:
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))
 

klaus

Expert
Licensed User
Longtime User
This code works in the demo project.
B4X:
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.
 

vecino

Well-Known Member
Licensed User
Longtime 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.
 

vecino

Well-Known Member
Licensed User
Longtime User
I already found out.
It's simple, I assign the colors you want.
Regards.
 

AHilberink

Active Member
Licensed User
Longtime 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é
 

AHilberink

Active Member
Licensed User
Longtime User
You have to increase the RowHeight and:
and set Table1.SingleLine = False.

Hi Klaus,

When do I set these? I have add by CustomView and this code:
B4X:
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é
 

klaus

Expert
Licensed User
Longtime User
This code should work.
B4X:
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))
 

fishwolf

Well-Known Member
Licensed User
Longtime User
Is it possible set fixed colomns?

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

Thanks
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…