iOS Question Touch event on two panels

angel_

Well-Known Member
Licensed User
Longtime User
I have one panel inside another panel and both with the Touch event, when the B4XSwitch is true I want only the parent panel event to be available, Is it possible to get this behavior?

B4X:
Private Sub Panel1_Touch(Action As Int, X As Float, Y As Float)
    Log("Panel1_Touch")
End Sub

Private Sub Panel2_Touch(Action As Int, X As Float, Y As Float)
    If swhNoEvent.Value Then
        'only event Panel1_Touch
        Return
    End If
    Log("Panel2_Touch")
End Sub
 

Attachments

  • Project.zip
    175.5 KB · Views: 227

angel_

Well-Known Member
Licensed User
Longtime User
Thank you

B4X:
Private Sub Panel1_Touch(Action As Int, X As Float, Y As Float)
    Log("Panel1_Touch")
End Sub

Private Sub Panel2_Touch(Action As Int, X As Float, Y As Float)
    Log("Panel2_Touch")
End Sub

Private Sub swhNoEvent_ValueChanged (Value As Boolean)
    If Value Then
        Panel2.As(NativeObject).SetField ("userInteractionEnabled", False)
        Log("Only Panel1_Touch")
    Else
        Panel2.As(NativeObject).SetField ("userInteractionEnabled", True)
        Log("Panel2_Touch")
    End If
End Sub
 
Upvote 0
Top