on = reserved word! Exception handling.
m.

-----Original Message-----
From: gajo [mailto:[EMAIL PROTECTED]
Sent: Sunday, 9 November 2003 04:49
To: Multiple recipients of list delphi
Subject: [DUG]: Weird error?


I just don't get the following: I've created an object TSomething that has
one special property:

Status = (on,off)

So I've created an array of TSomething, and wrote the following procedure
(inside another function):

// ------------------>
procedure TForm1.OtherProcedure(Sender: TObject);

 function Alive(s: TPSomething): Boolean;
 begin
// I get an error message saying "Not enough parameters" here:
  if s.Status = on then result := True else
   result := False
 end;

var
 a: array[1..100] of TSomething;
begin
 // create and do something else...
 if Alive(a[5]) then DoSomethingElse;
end;
// <-------------------

If I write

if s.Status = off then result := False else
 result := True

Then the function works fine, but I don't want to use it because I don't
know what went wrong with the previous one, I mean, why can't I use Status =
on, but I can use Status = off?

So I've put a TSomething on the form, put a button and wrote the following:

procedure TForm1.Button1Click(Sender: TObject);
begin
 Something1.Status := on;
 if Something1.Status = on then ShowMessage('on') else
  ShowMessage('off')
end;

No error messages here! Why?

Gajo

---------------------------------------------------------------------------
    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/
---------------------------------------------------------------------------
    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