delphiwizarddelphi-xeopentools

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.


Solution

  • 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.