Hi all,
I don't understand how shouId code about 'NotUsed' parameter in this as belows
B4X:
#If B4i
If xui.SubExists(mCallBack, mEventName & "_ResultCalculated",?) Then '<== How to code?
CallSubDelayed2(mCallBack, mEventName & "_ResultCalculated", result)
End If
#Else
If xui.SubExists(mCallBack, mEventName & "_ResultCalculated",?) Then '<== How to code?
CallSubDelayed2(mCallBack, mEventName & "_ResultCalculated", result)
End If
#End If
The value is for the number of parameters the sub expects, but is only used with b4i. If you are not using b4i you can use any valid int for instance 0. It might just be easier and more consistent to put the actual number of parameters even though it does nothing:
B4X:
#If B4i
If xui.SubExists(mCallBack, mEventName & "_ResultCalculated",1) Then 'Correct value is required
CallSubDelayed2(mCallBack, mEventName & "_ResultCalculated", result)
End If
#Else
If xui.SubExists(mCallBack, mEventName & "_ResultCalculated",1) Then 'Value is ignored but must be an int.
CallSubDelayed2(mCallBack, mEventName & "_ResultCalculated", result)
End If
#End If
The value is for the number of parameters the sub expects, but is only used with b4i. If you are not using b4i you can use any valid int for instance 0. It might just be easier and more consistent to put the actual number of parameters even though it does nothing:
B4X:
#If B4i
If xui.SubExists(mCallBack, mEventName & "_ResultCalculated",1) Then 'Correct value is required
CallSubDelayed2(mCallBack, mEventName & "_ResultCalculated", result)
End If
#Else
If xui.SubExists(mCallBack, mEventName & "_ResultCalculated",1) Then 'Value is ignored but must be an int.
CallSubDelayed2(mCallBack, mEventName & "_ResultCalculated", result)
End If
#End If
It's the number of parameters the routine you want to verify exists requires.
In this case, the routine you want to call is ResultCalculated which requires only one parameter, so that number in B4I must be one. In other cases, the routine might require two parameters, for example, and you created that routine, so you know they are two.