Solved

Is it safe to rearrange the procedure declaration in the interface section

Posted on 2011-09-11
4
336 Views
Last Modified: 2012-05-12
Hello,

I have all these procedures and functions declarations inside the interface section and some of it my own procedures and methods and some of it is generated by the component events found in the object inspector.

Is it safe to rearrange them as mine kinda has no order to it. Its hard to find things and Hard to see what functions or procedure I have implemented and what I have not.

Thanks,

Ben
0
Comment
Question by:AivsCoder
4 Comments
 
LVL 25

Accepted Solution

by:
epasquier earned 34 total points
ID: 36521141
it is totally safe, as long as you leave the generated ones (events) in the first section of objects

Of course, it is well to organize things a bit when a form is growing. I often even rearrange the components declarations, and of course events (so the generated parts)

Adding some section separators can help also, like
//==== SECTION 1 ===============================================
//---- SUB SECTION 1.1 -----------------------------------------

Open in new window

0
 
LVL 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 33 total points
ID: 36522719
the only thing you need to consider is top down logic
for procedures in the interface section this is no problem, but it may be in the implementation section

sample in implementation (doesn't compile)

 
procedure TestA;
begin
  TestB;
end;

procedure TestB;
begin
  ShowMessage('TestB');
end;

Open in new window


for class types (and const) this may be a problem in the interface
this compiles:
 
Const
  CParentID = 1;
 
Const 
  CChildID = CParentID + 1;

type
  TParentClass = class(TObject)
  end;

  TChildClass = class(TParentClass)
  end;

Open in new window


this doesn't compile:
 
Const 
  CChildID = CParentID + 1;

Const
  CParentID = 1;
 

type
  TChildClass = class(TParentClass)
  end;

  TParentClass = class(TObject)
  end;

Open in new window

0
 
LVL 32

Assisted Solution

by:ewangoya
ewangoya earned 33 total points
ID: 36526907

All procedures and functions in alphabetical order works well for me, actually if you use ctr+alt+shift, you will always get your procedures and functions arranged in order in the implementation
0
 

Author Closing Comment

by:AivsCoder
ID: 36527205
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now