DelphiFAQ Home Search:

Allowing Delphi to remove your empty methods

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

By default, Delphi removes any empty event handlers each time your save or rebuild your application. However, you may have noticed that it doesn't remove your methods--even if they're empty.

The secret to this phenomenon is that Delphi places event handlers in the published section of the form's class declaration. (This is the section between the classname specifier and the private section of the class declaration.) If you place your methods in the same section of the class declaration, as shown below, then it will not remove your method, even if empty.

type
  TForm1 = class(TForm)
    procedure MyProc;
  private
    { private declarations }
  public
    { public declarations }
  end;
You don't like the formatting? Check out SourceCoder then!

Comments:

2006-11-24, 08:50:51
anonymous from China  
good but this's Code is very easy! what do you think?

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: