Discussion:
IOTAProjectCreator with name und directory
(too old to reply)
Christian Bugge
2007-11-16 14:37:25 UTC
Permalink
Hi
I'm using the IOTAProjectCreator as in the example
from here: http://www.gexperts.org/opentools/ with Delphi 2007.

Now I like to give a Project name and directory automatically.
I do the following:

ProjectModule := (BorlandIDEServices as
IOTAModuleServices).CreateModule(TProjectCreatorModule.Create);
ProjectModule.FileName := 'P:\Newdir\Test\Test1.dproj';
// Now create a Form for the Project since the code added to the Project
expects it.
FormModule := (BorlandIDEServices as
IOTAModuleServices).CreateModule(TFormCreatorModule.Create);
FormModule.FileName := 'P:\Newdir\Test\Unit1.pas';
FormModule.Save(False,True);
// Now create a DataModue for the Project since the code added to the
Project expects it.
DataModule := (BorlandIDEServices as
IOTAModuleServices).CreateModule(TDataModuleCreatorModule.Create);
DataModule.FileName := 'P:\Newdir\Test\DataModul1.pas';
DataModule.Save(False,True);
ProjectModule.Save(False,True);

This works but opening the Unit1 and datamodul1 gives me an error. You see
the directory tree under the project.
If I close delphi and open it again the project and units are fine. So I'm
not far away from a solution.

Greetings from switzerland
Christian Bugge
Erik Berry
2008-02-24 22:03:11 UTC
Permalink
Post by Christian Bugge
This works but opening the Unit1 and datamodul1 gives me an error. You see
the directory tree under the project.
It might be helpful to quote the exact error message you are getting. In
general, I don't recommend using the creator interfaces for anything beyond
basic needs since I've found manually writing out the required project and
unit files and then auto-opening the project the IDE often works much better,
but with some trial and error some basic types of creators can be made to work.

You might also try letting the creators create the files for you and then
calling something like IOTAFileSystem.RenameFile, or similar. You could also
try saving your project, closing it and reopening it automatically, since
that seems to fix it.

Erik

Loading...