B4J Question set mouse events to all panes in a generic sub

Hello everybody.
My RootPane has several other panes created programmatically (not in the designer).
I can implement mouse events for each of them separately.
This makes the code very long, boring and not at all productive.
I'm trying to get a generic method that filters in MainForm.RootPane.GetAllViewsRecursive, each Pane.Tag with select case
Is it possible to get this approach?

Thanks in advance for the help
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I can implement mouse events for each of them separately.
This makes the code very long, boring and not at all productive.
Set the event name to be the same:
B4X:
For i = 1 To 100
Dim pnl As B4XView = XUI.CreatePanel("pnl")
 ...
Next

Private Sub pnl_Touch (Action As Int, X As Float, Y As Float)
    Dim pnl As B4XView = Sender
    
End Sub
 
Upvote 1
Top