Don't Execute code in design time

I have made a TComponent decendent, and I want it to skip a certain block of code if it is still in design time in delphi (on the form in delphi, in other words) .  At first, I thought I could just look for delphi's TAppbuilder using FindWindow to see if it is running, but then it will never execute the code when delphi is running at the same time.  Is there some compiler directive?  I've seen alot of {if ...}'s and I don't know if there is one that applies to this.  Any help?
LVL 1
bogieman_Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kretzschmarCommented:
hi bogieman,

what about

if not(csDesigning in componentState) then
...

meikl
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PeterLarsenCommented:
Try this :

if csDesigning in YourComponent.ComponentState then
begin
 //Enter designtime code here
end
else
begin
 //Enter runtimecode here
end;

Regards
Peter
0
PeterLarsenCommented:
Well, to slow i see :-)
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

bogieman_Author Commented:
Hmmm...accept kretzschmar  or PeterLarsen - you will both have to prove to me that you are worthy of points...
0
PeterLarsenCommented:
Just give the points to Meikl, he was there first - and he need it :-)
0
bogieman_Author Commented:
I'm sure it works so here are the stinking points.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.