I'm getting this error when trying to add a click even to a dynamically generated panel.
Here is (basically) what I'm doing...only adding snippet because I'm more interested in what the error means:
B4X:
...
pnl.Initialize("dPanel")
...
Sub dPanel_Click(pnl as Object)
Dim p as Panel
p = pnl
Msgbox(p.Tag, "FOO")
End Sub
When I tap on the panel, I get an error message saying:
"An error has occurred in the sub: dpanel_click signature does not match expected signature. Continue?"
The error means that the subroutine definition Sub dPanel_Click(pnl as Object) is not formed correctly.
The panel _click subroutine does not expect any arguments to be returned. So it's signature should be
Sub dPanel_Click
.
.
.
End sub
If you want to get the panel object when clicked, it is provided by the sender object;
Sub dPanel_Click
Dim P As Panel
P = Sender
.
.
.
End sub
If you type Sub and then a space in the IDE it prompts you to press tab to insert the event declaration, press tab and you get a list of objects select one and press enter and it lists the declarations and their required formats. Select one of these and it will insert the correct signature for you.
If you type Sub and then a space in the IDE it prompts you to press tab to insert the event declaration, press tab and you get a list of objects select one and press enter and it lists the declarations and their required formats. Select one of these and it will insert the correct signature for you.
If you type Sub and then a space in the IDE it prompts you to press tab to insert the event declaration, press tab and you get a list of objects select one and press enter and it lists the declarations and their required formats. Select one of these and it will insert the correct signature for you.
It doesn't work in a Code Module as you cannot capture events there, but it should work in Activity modules.
I seem to remember reading a post that said it wouldn't prompt under certain circumstances, I think it was to do with malformed subs or loops, but I can't find the post and cant get the prompt to not work.
If you're still having trouble, try it in a new project just to see.