• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Anyone know delphi?

## Recommended Posts

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.

##### Share on other sites
if Sender is TButton thenbegin     ShowMessage(TButton(Sender).Caption);end;

##### Share on other sites
You can also use the "as" keyword. For instance
with Sender as TButton dobegin     ShowMessage(Caption);end;

##### Share on other sites
Thanks, You just saved me from on huge case statement!

• ### Forum Statistics

• Total Topics
627702
• Total Posts
2978712

• 21
• 14
• 12
• 10
• 12