Reputation: 3791
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.
Upvotes: 7
Views: 1075
Reputation: 1195
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.
Upvotes: 4
Reputation: 37211
In my tests, it works as you expected (ModuleIdent
parameter in NewImplSource
method receives the new unit name). Check your implementation again, especially make sure that:
IOTACreator.GetUnnamed
returns TrueIOTACreator.GetExisting
returns FalseIOTACreator.GetCreatorType
returns the appropriate identifier (sUnit
, sForm
, etc.) - I'm not sure about this but it might be important, tooHere is a working example. I just checked it and the code still seems to work as expected in Delphi XE.
Upvotes: 2
Reputation: 989
The method IOTAModuleCreator.NewImplSource have a "ModuleIdent" parametter, it is the unit name.
Upvotes: 2