mangojack Expert Licensed User Longtime User Jun 26, 2025 #1 Adding a simple _Click Event to a Custom View (without parameters) results in a warning "," expected then an error when compiling. Normaly a _Click event does not have any parameters , and I do not need to pass any. An Earlier tutorial for Custom Views shows you did not need to pass any . Custom Views with Designer Support Code: 'Events declaration #Event: DoubleClick #Event: SingleClick But then an updated tutorial ( B4J ) shows Event declaration as such .. Code: #Event: ExampleEvent (Value As Int) The B4A Manual simply states ... If the event routine has parameters these must also be declared. #Event: ExampleEvent (Value As Int) I can just pass a Boolean in the signature and all is good and problem solved, But I just need clarification that Custom View Events by default must have at least a single parameter , or I am doing something wrong. Regards and Thanks
Adding a simple _Click Event to a Custom View (without parameters) results in a warning "," expected then an error when compiling. Normaly a _Click event does not have any parameters , and I do not need to pass any. An Earlier tutorial for Custom Views shows you did not need to pass any . Custom Views with Designer Support Code: 'Events declaration #Event: DoubleClick #Event: SingleClick But then an updated tutorial ( B4J ) shows Event declaration as such .. Code: #Event: ExampleEvent (Value As Int) The B4A Manual simply states ... If the event routine has parameters these must also be declared. #Event: ExampleEvent (Value As Int) I can just pass a Boolean in the signature and all is good and problem solved, But I just need clarification that Custom View Events by default must have at least a single parameter , or I am doing something wrong. Regards and Thanks
Solution klaus Jun 26, 2025 mangojack said: Adding a simple _Click Event to a Custom View (without parameters) results in a warning "," expected then an error when compiling. Click to expand... You should show us your code. So we can see what you are doing. Which event in the CustomView is supposed to generate the Click event. As an example, this code works: B4X: Private Sub lblX_Click et.Text = "" If SubExists(mCallback, mEventName & "_Click") Then CallSub(mCallback, mEventName & "_Click") End If End Sub I am afraid that you tried with CallSub2 instead of CallSub.
mangojack said: Adding a simple _Click Event to a Custom View (without parameters) results in a warning "," expected then an error when compiling. Click to expand... You should show us your code. So we can see what you are doing. Which event in the CustomView is supposed to generate the Click event. As an example, this code works: B4X: Private Sub lblX_Click et.Text = "" If SubExists(mCallback, mEventName & "_Click") Then CallSub(mCallback, mEventName & "_Click") End If End Sub I am afraid that you tried with CallSub2 instead of CallSub.
mangojack Expert Licensed User Longtime User Jun 26, 2025 #2 Just to clarify , I am attempting to add a second Event to the Custom View Places Autocomplete The view already had an event in place which did have parameters.. Code: #Event: ItemClick (Place As PlaceData) #Event: Click 'will not accept this event without parameter Upvote 0
Just to clarify , I am attempting to add a second Event to the Custom View Places Autocomplete The view already had an event in place which did have parameters.. Code: #Event: ItemClick (Place As PlaceData) #Event: Click 'will not accept this event without parameter
klaus Expert Licensed User Longtime User Jun 26, 2025 #3 mangojack said: Adding a simple _Click Event to a Custom View (without parameters) results in a warning "," expected then an error when compiling. Click to expand... You should show us your code. So we can see what you are doing. Which event in the CustomView is supposed to generate the Click event. As an example, this code works: B4X: Private Sub lblX_Click et.Text = "" If SubExists(mCallback, mEventName & "_Click") Then CallSub(mCallback, mEventName & "_Click") End If End Sub I am afraid that you tried with CallSub2 instead of CallSub. Upvote 1 Solution
mangojack said: Adding a simple _Click Event to a Custom View (without parameters) results in a warning "," expected then an error when compiling. Click to expand... You should show us your code. So we can see what you are doing. Which event in the CustomView is supposed to generate the Click event. As an example, this code works: B4X: Private Sub lblX_Click et.Text = "" If SubExists(mCallback, mEventName & "_Click") Then CallSub(mCallback, mEventName & "_Click") End If End Sub I am afraid that you tried with CallSub2 instead of CallSub.
mangojack Expert Licensed User Longtime User Jun 26, 2025 #4 klaus said: I am afraid that you tried with CallSub2 instead of CallSub. Click to expand... Thank you Klaus ... Thats exactly the case . I was using CallSub2 , which expected a 3rd Parameter - Argument As Object. I Have altered my code , calling CallSub () solves the issue. Could not see the forrest for the trees ... Upvote 0
klaus said: I am afraid that you tried with CallSub2 instead of CallSub. Click to expand... Thank you Klaus ... Thats exactly the case . I was using CallSub2 , which expected a 3rd Parameter - Argument As Object. I Have altered my code , calling CallSub () solves the issue. Could not see the forrest for the trees ...