Link to home
Start Free TrialLog in
Avatar of qas
qas

asked on

Sender: TObject

How can I use the Sender object in my app ?

example:

procedure TfrmClients.cbNoClientsClick(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!!
ASKER CERTIFIED SOLUTION
Avatar of simonet
simonet
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yeah I agree with Alex. You would need to specifically Identify the actual object being passed in your parameter. :>(
Avatar of qas
qas

ASKER

Perfect!
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
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
Sorry for the "double" comment... this thing got stucked!

I knew simonet's solution, but didn't remember it... give him the points! :-)