Anyone know delphi?

Started by
2 comments, last by furiousp 20 years ago
Ok say i have a procedure in delphi like this: procedure btnTestClick(Sender: TObject); How can i actually access any of the properties of the sender? (i.e. it''s caption or name). All i can seem to be able to get is info on the class type. I am an amateur but it would seem like this should be straight forward.
Advertisement
if Sender is TButton thenbegin     ShowMessage(TButton(Sender).Caption);end;
You can also use the "as" keyword. For instance
with Sender as TButton dobegin     ShowMessage(Caption);end;
Thanks, You just saved me from on huge case statement!

This topic is closed to new replies.

Advertisement