[Solved] How important is it to use “sender” lazarus / 61-Beginners ---------------------------------------------------------------------- Kraig · 2023-11-20 12:29 I often get warnings that “sender was not used”. I’m doing fairly simple  things where the sender is the control itself. To use the sender:tobject  I would have to do type checking and Type casting. It seems like a lot of extra effort. I can understand the idea of using sender if more than one type of control was being sent to the procedure which would cause different things to happen. Am I being too lazy by not using sender? What’s the worst thing that can happen? ---------------------------------------------------------------------- Zvoni · 2023-11-20 12:33 Quote from: Kraig on November 20, 2023, 01:29:06 pmI often get warnings that “sender was not used”. I’m doing fairly simple  things where the sender is the control itself. To use the sender:tobject  I would have to do type checking and Type casting. It seems like a lot of extra effort. I can understand the idea of using sender if more than one type of control was being sent to the procedure which would cause different things to happen. Am I being too lazy by not using sender? What’s the worst thing that can happen? If you use one Event-Handler for multiple controls, Sender is your only way to find out, which control fired it. ---------------------------------------------------------------------- Kraig · 2023-11-20 12:37 Yes I sometimes do that and in that case I do check what the sender is before using it. ---------------------------------------------------------------------- Bart · 2023-11-20 17:10 Quote from: Kraig on November 20, 2023, 01:29:06 pmAm I being too lazy by not using sender? What’s the worst thing that can happen? That depends on what you do in the event. In most cases it's probably irrelevant who/what Sender is. As others have pointed out, you can assing 1 eventhandler to multiple components, and in such a case it may very well be relevant who the sender is. Only you, the programmer, knows if this is the case. Bart ---------------------------------------------------------------------- Kraig · 2023-11-21 00:13 Thanks for the answers