qas
asked on
Sender: TObject
How can I use the Sender object in my app ?
example:
procedure TfrmClients.cbNoClientsCli ck(Sender: TObject);
begin
with Sender do
begin
//doStuffWithSender
end;
end;
I want to use the methods and properties of Sender but I can't manage to tell my app what Sender is actually. Is there any way to tell my app that the Sender is a button or a combobox or something ?
Thanks!!
example:
procedure TfrmClients.cbNoClientsCli
begin
with Sender do
begin
//doStuffWithSender
end;
end;
I want to use the methods and properties of Sender but I can't manage to tell my app what Sender is actually. Is there any way to tell my app that the Sender is a button or a combobox or something ?
Thanks!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yeah I agree with Alex. You would need to specifically Identify the actual object being passed in your parameter. :>(
ASKER
Perfect!
Exacly what I needed.
I actually knew what the component was. I just didn't kow how to tell the app.
Thanks!
Exacly what I needed.
I actually knew what the component was. I just didn't kow how to tell the app.
Thanks!
You may try this one:
if Sender.ClassName='TButton' then ...
if Sender.ClassName='TEdit' then ...
Of course you're gonna have a lot of work. it only depends on wich objects directly call that method.
Hope you like this approach :-)
Best regards
if Sender.ClassName='TButton'
if Sender.ClassName='TEdit' then ...
Of course you're gonna have a lot of work. it only depends on wich objects directly call that method.
Hope you like this approach :-)
Best regards
You may try this one:
if Sender.ClassName='TButton' then ...
if Sender.ClassName='TEdit' then ...
Of course you're gonna have a lot of work. it only depends on wich objects directly call that method.
Hope you like this approach :-)
Best regards
if Sender.ClassName='TButton'
if Sender.ClassName='TEdit' then ...
Of course you're gonna have a lot of work. it only depends on wich objects directly call that method.
Hope you like this approach :-)
Best regards
Sorry for the "double" comment... this thing got stucked!
I knew simonet's solution, but didn't remember it... give him the points! :-)
I knew simonet's solution, but didn't remember it... give him the points! :-)