Android Question AS FloatingActionMenu Show Menu on Button in b4xTable ?

jahswant

Well-Known Member
Licensed User
Longtime User
I have tried a lil hard to show ma neu in a b4x table row all my tests failed can some one provide an exaple for that ?
 
Solution
B4XTableASFloatingActionMenu-ezgif.com-resize.gif


B4X:
Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
    Dim RowData As Map = B4XTable1.GetRow(RowId)
    Dim cell As String = RowData.Get(ColumnId)
    B4XPages.SetTitle(Me, cell)
    
    OpenMenu(RowId)
End Sub

Private Sub OpenMenu(RowId As Long)
    
    Dim Counter As Int = 0
    For Each VisibleRow As Long In B4XTable1.VisibleRowIds
        If VisibleRow = RowId Then
            Exit
        End If
        Counter = Counter +1
    Next
    
    Log(Counter)
    
    Dim TargetTop As Float = B4XTable1.mBase.Top + B4XTable1.pnlHeader.Height + B4XTable1.HeadersHeight + B4XTable1.RowHeight*Counter + B4XTable1.RowHeight/2
    
    FloatingActionMenu.Initialize(Me,"FloatingActionMenu",Root)...

Alexander Stolte

Expert
Licensed User
Longtime User
B4XTableASFloatingActionMenu-ezgif.com-resize.gif


B4X:
Sub B4XTable1_CellClicked (ColumnId As String, RowId As Long)
    Dim RowData As Map = B4XTable1.GetRow(RowId)
    Dim cell As String = RowData.Get(ColumnId)
    B4XPages.SetTitle(Me, cell)
    
    OpenMenu(RowId)
End Sub

Private Sub OpenMenu(RowId As Long)
    
    Dim Counter As Int = 0
    For Each VisibleRow As Long In B4XTable1.VisibleRowIds
        If VisibleRow = RowId Then
            Exit
        End If
        Counter = Counter +1
    Next
    
    Log(Counter)
    
    Dim TargetTop As Float = B4XTable1.mBase.Top + B4XTable1.pnlHeader.Height + B4XTable1.HeadersHeight + B4XTable1.RowHeight*Counter + B4XTable1.RowHeight/2
    
    FloatingActionMenu.Initialize(Me,"FloatingActionMenu",Root)
 
    FloatingActionMenu.Color = xui.Color_White
    FloatingActionMenu.TextColor = xui.Color_Black
    FloatingActionMenu.ItemProperties.SeperatorVisible = True
 
    FloatingActionMenu.AddItem("Item #1",FloatingActionMenu.FontToBitmap(Chr(0xE190),True,30,xui.Color_Black),0)
    FloatingActionMenu.AddItem("Item #2",FloatingActionMenu.FontToBitmap(Chr(0xE190),True,30,xui.Color_Black),1)
    FloatingActionMenu.AddItem("Item #3",FloatingActionMenu.FontToBitmap(Chr(0xE190),True,30,xui.Color_Black),2)
 
    Dim Height As Float = FloatingActionMenu.ItemProperties.Height*FloatingActionMenu.Size
 
    If TargetTop + Height > Root.Height Then
        TargetTop = Root.Height - Height
    End If
 
    FloatingActionMenu.ShowPicker(0,TargetTop,200dip,Height)
 
    Wait For FloatingActionMenu_ItemClicked(Item As AS_FloatingActionMenu_Item)
 
    Select Item.Value
        Case 0
            Log(Item.Text & " clicked")
        Case 1
            Log(Item.Text & " clicked")
        Case 2
            Log(Item.Text & " clicked")
    End Select
    
End Sub
 

Attachments

  • B4XTableExample.zip
    281.5 KB · Views: 64
Upvote 0
Solution
Top