Proliferation of mouse events lazarus / 21-General ---------------------------------------------------------------------- jlinux · 2024-03-09 01:28 In programs with a few dozen components such as buttons, etc., distributed across n panels where each panel has n buttons and its own unit, in order to make the code more organized, i think it is a bit stupid to have a proliferation of click events, one for each button. So i'm using a single event trap for all buttons, where within this procedure I call each group of components that belongs to a certain panel that has its own unit. For this purpose, all buttons points to the address of that unique/global event trap. This is working ok, so, my question is more about  of what you expert guys think about this approach and if there are a better alternatives to do this. Appreciated in advance. ---------------------------------------------------------------------- jamie · 2024-03-09 02:24 using such tactics shows how clever you are! Coding is not only how to make it work but also how to make it work sensibly. ---------------------------------------------------------------------- Handoko · 2024-03-09 03:38 @jlinux I am not an expert. And yes, I use the tricks frequently. It really makes the code more organized, so the end result is less bugs. ---------------------------------------------------------------------- jlinux · 2024-03-13 13:20 jamie and Handoko, thanks for the comments. It seems like the idea isn't that stupid. I use this and other kinds of "strategies" in code for MCU's, mostly c and assembly in very special cases, so my question was due to not having enough experience and knowledge about object pascal.