B4J Question [SOLVED] How to add context menu to pragmatically generated labels and catch right lick event

Nokia

Active Member
Licensed User
Longtime User
I am pragmatically adding labels to a panel with the following code:
B4X:
Sub ShowVar(ID As String, Text As String)
    
    Dim L As Label
    L.Initialize("VarLabel")
    L.ID = ID
    L.Text = Text
    
    Dim bAdd As Boolean = True
    For i = 0  To fpScriptV.NumberOfNodes - 1
        Dim n As Label = fpScriptV.GetNode(i)
        If N.ID = ID  Then
            bAdd = False
            Exit
        End If
    Next
    
    If bAdd = True Then
        fpScriptV.AddNode(L,0,0,160,22)
    End If
End Sub

How can I add a ContextMenu that when right clicked on the label will copy the label.text or lable.id from the label and apply it to the clip board so a user can past it somewhere else.

there will be multiple lables...
 
Top