Add new proc/func to the end of file

Please can new functions or procedures be added at the end of the file not at the beginning of the first proc/func

I comment each of mine with something like this

{------------------------------------------------- ----------------------------- ------------------------------------ -
ChangePage procedure
...
...
-------------------------------------------------- ----------------------------}

and each time I need to remap my code.

And it's not easier to add it before the last "end." ???

Thanks

Please, can you post a sample unit? Maybe we can add a setting to decide where event handlers should be added, but in RAD Studio they are added in alphabetic order, so don't know how that works for you.

Hi Jose,
If you start a new project with VS you put a button and add a procedure on click
after you comment your procedure with a head

{------------------------------------------------- -----------------------------
procedure button_click
-------------------------------------------------- ----------------------------}
procedure TForm.button_Click(Sender: TObject);
begin
end;

iy you add a new function onshow form for example this is happens

{-----------------------------------------------------------------------------
procedure TMapForm.MapFormShow(Sender: TObject); // here a new declaration is added inside comments
begin
end;

procedure MapFormCreate
-----------------------------------------------------------------------------}

procedure TMapForm.MapFormCreate(Sender: TObject);
begin
end;

Please, check the attached animation for RAD Studio:

  • Add an event
  • Comment such event in the same way you are doing it
  • Add an event that, alphabetically is going to be added "before" the event you just added
  • As you see, the comment you added for the first event, now is located on top of the second event, which I guess is not the expected behavior

Please, can you try to do the same? Because it will work only if the event you add is, alphabetically, added "after" the events you already have, but not on any other situation.

events

Sorry Jose, (I use only VS)
but this is not correspond to my need.

There's no alphabetic order in my code.
I sort my code with type of event not in alphabetic order.

Most of time I put first event about form.
After proc about squeleton of my form etc....

I have something like this :

{---------------------------------------
procedure Beta : Comments
----------------------------------------}
procedure Beta
begin
end;

{---------------------------------------
procedure Alpha : Comments
----------------------------------------}
procedure Alpha
begin
end;

{---------------------------------------
function Tools1 : Comments
----------------------------------------}
function Tools1
begin
end;

end.

it's so complicated to add new function at the end of code just before "end."

There are multiple considerations when adding an event, is not as simple as what you say just before "end." because there is code that could be there, like initialization, etc. We will take a looking and evaluate the behavior, but RAD Studio doesn't work the way you describe either, that is, they don't add the event just before the "end.", but alphabetically, so if we make a modification on the current VSC behavior, would be to match RAD Studio, or at least, with a setting that you can chose.

And please, not that, in the code you put here, in RAD Studio, if you add an event (not a function you add manually) that, alphabetically should be located "before" Beta procedure, your comments will be screwed.

Maybe Jose,
but I don't use Rad Studio.
I only use Delphi 7 for desktop appli and VS for Tms Web Core.
And With Delphi 7 new function are added at the end of code just before last END.

Ok, we will consider it, but as I explained, is not as easy as that, because there is initialization section, also in Delphi 7, so we will need how to do it in a way that doesn't affect comments also on methods. Will let you know once it's added.

I understand Jose. I hope that someday this feature will be available.
Thanks