[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

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?
0
bogieman_
Asked:
bogieman_
  • 3
  • 2
1 Solution
 
kretzschmarCommented:
hi bogieman,

what about

if not(csDesigning in componentState) then
...

meikl
0
 
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now