In this case the answer is 1.
It does depend on how the property is implemented. A lot of them use window
messages, so are slower than a straight value/field read - even the reads
will send a window message (or ) - eg Text/Caption property does this have a
look at TControl.GetText and TControl.SetText
Best to look at the source if you don't know.
Myles.
-----Original Message-----
From: Ross Levis [mailto:[EMAIL PROTECTED]]
Sent: Friday, 27 July 2001 4:55 p.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Speed question
Which of the following statements execuates faster if the button is
already enabled?
1. OKButton.Enabled := True;
2. if OKButton.Enabled = False then OKButton.Enabled := True;
If the answer is 2, does anyone bother doing it that way?
Also, if I'm enabling the button in numerous procedures, is it
better/faster to execute a procedure with just the one line in it?
Cheers,
Ross.
---------------------------------------------------------------------------
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/