The new custom class customview does not trigger the Click event.
ImageButton Is a custom class name that creates an icon button ImageButton1 in B4xPage, but its Click event does not respond.
The following code is used in the class:
B4X:
Private Sub mBase_Click
If SubExists(mCallBack, mEventName & "_Click") Then
CallSubDelayed(mCallBack, mEventName & "_Click")
End If
End Sub
The following code is used in the B4xPage:
B4X:
Private Sub ImageButton1_Click
xui.MsgboxAsync("Hello world!", "B4X")
End Sub
The Click event attribute was added to the class module:
#Event:Click
The problem has been solved.
Carefully studied the xCustomButton class of Mr klaus, found that mBase is B4XView.
So I also defined my mBase as B4XView, and I also solved this problem with the following code.
B4X:
Private Sub mBase_Touch (Action As Int, X As Float, Y As Float)
Select Action
Case mBase.TOUCH_ACTION_UP
If xui.SubExists(mCallBack, mEventName & "_Click", 0) Then
CallSubDelayed(mCallBack, mEventName & "_Click")
End If
End Select
End Sub