Thread: AfterCreate

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2015
    Posts
    6
    Rep Power
    0

    AfterCreate


    I need an AfterCreate in a Tobject because I need the MemoryStream to operate.
    If I had a component their must be a way to catch the state designtime/Runtime

    But I have an object so I was thinking of using a thread with a sleep that will drive AfterCreate and destroy its self. And give a Boolean saying AfterCreate has run.

    Can you see any problems with this idea
    Should I use the thread to execute a message to run AfterCreate as a safer way to remove any conflicts.
    TApplication.Idile is an event little hard to reach I think and may get used twice
    Using Delphi 7
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    397
    Rep Power
    0
    Originally Posted by lexd
    If I had a component their must be a way to catch the state designtime/Runtime
    To determine within your component if it is within the IDE or if it is in a running application just check its component state.

    Code:
    if (csDesigning in ComponentState) then
       //within the IDE
    Originally Posted by lexd
    But I have an object so I was thinking of using a thread with a sleep that will drive AfterCreate and destroy its self. And give a Boolean saying AfterCreate has run.
    if you really need an AfterCreate Event for your component, then just override the AfterConstruction method. See here.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2015
    Posts
    6
    Rep Power
    0
    Public
    procedure AfterConstruction; override;

    yes that's the best way, Why I could not recall that I do not know but thats the best way for my project
    Thanks.

IMN logo majestic logo threadwatch logo seochat tools logo