Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
When to use the OnCreate, OnShow, OnActivate, and OnPaint events of a TForm Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
16-Mar-03
Category
VCL-Forms
Language
Delphi All Versions
Views
145
User Rating
8
# Votes
1
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

When to use the OnCreate, OnShow, OnActivate, and OnPaint events of a TForm

Answer:

Stuff that needs to be done to initialize the object (initializing variables and 
nested objects, etc.) should be done in the OnCreate event handler. That gets 
called as part of your constructor logic and is guaranteed to only be called once 
in the life of any object.

Stuff that needs to be drawn should always be done in the OnPaint event handler. 
Drawing for your form (except for other controls or components) must be done there 
or you won't have a chance to refresh it when needed. This gets called lots of 
times in the life of a form.

OnShow gets called when the form is first shown and when it is made visible after 
being hidden. This generally applies only to secondary forms. It should not be used 
to initialize anything.

OnActivate seems to get called at random intervals. Put your hand in that lion's mouth only if you have a surplus of digits ...

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC