Each button is defined as an area. A zone bounded by 4 corners, in terms of X,Y coordinates.
The operating system monitors the activity and when it detects a click somewhere, searches through the list of all the zones defined as valid buttons. When there is a match (the zone touched has its X coordinate bigger than X1, smaller than X2; and the Y is between Y1 and Y2? Then, user touched buttonA) the system creates an event, a signal that the thunkable program receives as âuser has clicked buttonAâ.
What this means is that there ISNâT an event that says âuser has clicked a button, and it happens to be buttonAâ where the button value is passed as a parameter.
You can create something that will be a close enough approximation, by having ALL the buttons click events call the same procedure, but with a different argument (i.e. button1 will call âbuttonclicked(1)â and button2 will call âbuttonclicked(2)â)
You will STILL need to have as many events has you have buttons.
But your âbuttonclicked(buttonid)â function would work just like this block that you envision.
One way of having the sort of thing you describe would be to use canvas (it does not exist in X thunkable, but I implement exactly that in one of my thunkable classic app) to cover the WHOLE area, and to use the âtouchdown(x,y)â event. Finding out which specific button was drawn at that location is then your responsibility.