I use common procedures for all Virtual Treeviews (TVirtualStringTree) so I only have 1 code to maintain, like for OnClick I use Common_VST_OnClick which all VST controls has set:
procedure TForm1.Common_VST_OnClick(Sender: TObject);
And to execute code based on which VST calls this on click procedure, I realized I use many different ways to recognize which control is Sender:
if Sender = VST1 then
if Sender.Name = VST1.Name then
if TVirtualStringTree(Sender) = VST1 then
if TVirtualStringTree(Sender).Name = VST1.Name then
if TVirtualStringTree(Sender).Name = 'VST1' then
The last is probably worst as the name is hardcoded, so I'm trying to only use 1 type of identification, in all procedures.
What is the best way to identify which control is Sender?