Android Question Add buttons to column in B4XTable

cdsincfl

Member
Licensed User
Longtime User
How do I add an edit column with buttons as in this example: B4XTable example when loading the table from a SQLite DB instead of CSV?

I tried to add them using this example loading B4XTable from a SQL table: B4XTable from SQL but can't find where to load the buttons to the column in code.
 

cdsincfl

Member
Licensed User
Longtime User
Sorry!

I did this and it worked:

B4X:
Sub LoadButtons
    For i = 1 To editCol.CellsLayouts.Size - 1
        Dim p As B4XView = editCol.CellsLayouts.Get(i)
        p.AddView(CreateButton("btnEdit", Chr(0xF044)), 2dip, 0dip, 40dip, 40dip)
        p.AddView(CreateButton("btnDelete", Chr(0xF00D)), 44dip, 0dip, 40dip, 40dip)
        p.AddView(CreateButton("btnDuplicate",Chr(0xF0C5)), 85dip, 0dip, 40dip, 40dip)
    Next
End Sub

Sub CreateButton (EventName As String, Text As String) As B4XView
    Dim Btn As Button
    Dim FontSize As Int = 14
    #if B4i
    Btn.InitializeCustom(EventName, xui.Color_Black, xui.Color_White)
    FontSize = 16
    #else
    Btn.Initialize(EventName)
    #End If
    Dim x As B4XView = Btn
    
    x.Font =  xui.CreateFontAwesome(FontSize)
    x.Visible = False
    x.Text = Text
    Return x
End Sub

Called LoadButtons after the table is loaded.
 
Upvote 0
Top