The expression you're testing in your Case statement must be an ordinal
type.  Therefore you can't use the Sender object itself directly.

However, you could cast it to something more useful, and use a property of
the Sender.

e.g.  TComponent introduces a Tag property. If you set the Tag property to
something unique for each of your components, you can use that in a case
statement:

procedure TForm1.Button1Click(Sender: TObject);
begin
  case TComponent(Sender).Tag of
    1:
    2:
    3:
  end;
end;

HTH,

Conor

-----Original Message-----
From: Alistair George [mailto:[EMAIL PROTECTED]]

Hi all.
Can I do a case statement with sender? The following is wrong, but you know
what I mean:

Proc setupparams(sender:tobject);
case sender of
Option1:
Option2:
Option3:
end;

cheers,
Al+
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to