R RJB Active Member Licensed User Longtime User Jun 9, 2022 #1 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. Code: 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
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. Code: 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
Erel B4X founder Staff member Licensed User Longtime User Jun 9, 2022 #2 A select / case block is your best option. Upvote 0