Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/IDE/Project Management/Project Source    [ Add a report in this area ]  
Report #:  32943   Status: Open
retain project source formatting structure while adding a new form/data module
Project:  Delphi Build #:  10.0
Version:    10.0 Submitted By:   Serguei Dosyukov
Report Type:  Minor failure / Design problem Date Reported:  8/21/2006 9:05:41 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   253302
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
3.00 out of 5
Total Votes: None
Description
this is common inconvinience with current implementation of the auto created forms when adding a new form/datamodule into the project

autocreate process "kills" formatting of the DPR when it is different from default - see steps
Steps to Reproduce:
1. create a new VCL Forms project (DW32)
2. one form is there by default

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

3. Add new form

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.Run;
end.

4. modify code as such

begin
  Application.Initialize;
  if ParamCount > 0 then
  begin
       Application.CreateForm(TForm1, Form1);
  end
  else
  begin
       Application.CreateForm(TForm2, Form2);
  end;
  Application.Run;
end.

5. Add another form  - your original format is "reformatted"

begin
  Application.Initialize;
  if ParamCount > 0 then
  begin
    Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm3, Form3);
  end
  else
  begin
  Application.CreateForm(TForm2, Form2);

  end;
  Application.Run;
end.
Workarounds
None
Attachment
None
Comments

Patrick Kolla-ten Venne at 8/23/2006 11:41:17 PM -
(btw: you can see the build number in the About screen)

What exactly do you suggest to make it better?

One thing for surely would be that the auto-inserted text uses the indenting setting and is not always indented 2 spaces, but that's not the thing you meant ;)

There really is a multitude of possible changes by the user.  Adding the new form after another inserted one is not the perfect solution, but do you know any better one?

Serguei Dosyukov at 9/7/2006 7:18:51 AM -
Please see provided code sample
problem is that when IDE autogenerate some lines it does not take in consideration surrounded code...

Patrick Kolla-ten Venne at 9/16/2006 2:23:54 AM -
Yeah, but how should the IDE know whether you designed Form3 for the ParamCount>0 or for the ParamCount=0 case?

Attaching the form after the first one is as much probably as attaching after the second or last one or wherever?

Or are you speaking just about the bad indentation?

Serguei Dosyukov at 9/17/2006 8:03:42 PM -
I am ok with current implementation on where in the file line for Form Auto creation is placed, but it should retain surrounded block level, instead of just placing the code line without additional indent.

Server Response from: ETNACODE01