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

    Join Date
    Dec 2008
    Posts
    119
    Rep Power
    6

    FormShow and FormCreate


    Hi All,

    In Delphi what is the difference between FormShow and FormCreate.

    Stephen
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    151
    Rep Power
    3
    Originally Posted by stephenalistoun
    Hi All,

    In Delphi what is the difference between FormShow and FormCreate.

    Stephen
    The main difference is that OnCreate event is called only once in the corresponding Form's lifetime. While OnShow will be called each time the Form's visibility is changed from hidden to shown.

    However nothing prevent you to call OnCreate event handler manually as many times as you need.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    However nothing prevent you to call OnCreate event handler manually as many times as you need.
    But that would be a very bad idea!

    Anything that you might want to do outside of FormCreate should be put in a separate method and called when needed, including from inside FormCreate if appropriate.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    151
    Rep Power
    3
    @Clive,

    Where did I say that it was a good idea? Was I wrong saying that you can call the OnCreate event handler anywhere in your code, since usually it's published?
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    Being able to do something does not mean it is a good idea.
    My intent was not to criticize you but to add advice for anyone who was
    learning from this thread.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    151
    Rep Power
    3
    Originally Posted by clivew
    Being able to do something does not mean it is a good idea.
    Again, Where did I say that it was a good idea?

    My intent was not to criticize you but to add advice for anyone who was learning from this thread.
    Just answer my question, please. Where did I say that it was a good idea?

IMN logo majestic logo threadwatch logo seochat tools logo