Example: I create a new unit, declare a class with several methods like constructor, destructor, method1, method2, method3 in that order and then hit Ctrl-Shift-C. The IDE creates all the method bodies automatically, but the order is mixed up and not as it was declared in the interface section.
Now, this is not a problem, but is there a reason for it. It seems to be more difficult to mix that up than to just do it in the order of the declaration.
Or is there some rule to it that makes sense which I cannot see?
By default, I'm pretty sure it tries to create them in alphabetical order by method name, and then tries to keep to this when more methods are added afterwards using the same method. The end result can be a bit of a random mix on ordering.
From my experience I find that some times the IDE creates the methods in alphabetical order, but other times it just append the new methods to the end of the file.
The IDE tries to create everything in alpahabetical order. But, if the methods become out of sequence (eg you rename a method) it gets in a muddle. The exact behaviour seems to depend on the version. Older versions would simply append the new method to the end of the file in any order. Newer versions seem a bit cleverer, but I haven't worked out exactly how yet.
This is a bit complicated to answer since it is dependent on how your methods are already arranged.
If they're already implemented in alphabetical order, it will try and maintain that. If the IDE cannot infer any kind of order, it resorts to dropping them at the end of the file.
There is another wrinkle where, by convention, if you include a comment in the form: { <ClassName> } before the first block of implemented method and then use that comment to delineate all subsequent class implementations, it will attempt to keep the methods grouped together.
The alphabetical ordering follows the same rules above, except it may inject the new methods into that logical block delineated by the indicated comment.
If you use class-completion with a brand new class, you'll notice that the IDE will automatically generate that delineating comment.
If you let class completion auto-arrange the methods and only use the Ctrl+Shift+UpAr key to navigate between a method's implementation and the declaration, the ordering should be less important.
Typically, I'll jump to the class decl using the above key-sequence, then use the arrow keys to go to the method in the decl I want, and then use that key-sequence again to quickly get to it.
Another nice key-sequence is the Ctrl+Alt+UpAr or Ctrl+Alt+DnAr which will quickly jump from method impl to method impl in file-order.