Y yshzsl Member May 17, 2024 #1 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: Copy 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: Copy Private Sub ImageButton1_Click xui.MsgboxAsync("Hello world!", "B4X") End Sub The Click event attribute was added to the class module: #Event:Click
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: Copy 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: Copy Private Sub ImageButton1_Click xui.MsgboxAsync("Hello world!", "B4X") End Sub The Click event attribute was added to the class module: #Event:Click
Y yshzsl Member May 18, 2024 #2 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: Copy 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 Upvote 0
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: Copy 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