B4R Question Calling different subs from the same code

RJB

Active Member
Licensed User
Longtime User
Hi,
I'm using a custom type to define 'windows', buttons etc. for display on an esp32 display.
I'd like to put a pointer to the handler for 'button pressed' event in the type,
e.g.
B4X:
Type Shape(X as int, Y as it, etc, etc, etc, EventName as string).

Sub EventName(Param1 as int, Param2......)

End Sub
I currently use Select/ case but with over 100 cases its a bit difficult to maintain!
Is there any way to do so? I thought perhaps CallSubPlus but the sub name has to be a literal string, not a variable.

Any ideas please?
Thanks
 
Top