Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you retrieve a new unit name from Delphi's open tools API

I have written a wizard in Delphi XE, and it is working fine. However, I have not figured out yet how to access the generated default unit name (or form name or project name) that Delphi's OTA can create.

In my old-style wizard I was able to call ToolServices.GetNewModuleName to discover an available unit and form name that I could use when generating the associated source files. What is the equivalent in today's open tools API?

According to the ToolsAPI unit comments, I should return a blank from the IOTAModuleCreator.GetImplFileName method to have Delphi generate the file name. I am returning an empty string from this method, but still cannot see where I can access the file name that Delphi is generating.

like image 819
Cary Jensen Avatar asked Nov 16 '10 16:11

Cary Jensen


2 Answers

There is a specific method for getting a new form and unit name:

(BorlandIDEServices as IOTAModuleServices).GetNewModuleAndClassName( '', UnitIdent, FormName, FileName);

I've used in a few examples and it seems to work fine.

like image 190
Marco Cantù Avatar answered Nov 15 '22 09:11

Marco Cantù


The method IOTAModuleCreator.NewImplSource have a "ModuleIdent" parametter, it is the unit name.

like image 21
Henri Gourvest Avatar answered Nov 15 '22 10:11

Henri Gourvest