|
|
|
IOTACreator function IOTACreator.GetCreatorType: string; This method informs the IDE as to what type of project you would like to create. The valid choices are:
Note here you should not return an Empty String. Then in the NewImplSource method you have the option to return an IOTAFile. function NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile; Returning an IOTAFile is how you define your own contents of the file.
function IOTACreator.GetExisting: Boolean; This method informs the IDE if the module is existing. Typically when creating a new object the object does not exist so the normal return value is False. The catch here is a object may have multiple Owner Modules so I am assuming that a "creation" in this case means the object exists and it is now a shared resource between more than one Module. I have not seen an example of this in my testing.
function IOTACreator.GetFileSystem: string; Returns the IDString of the FileSystem to use for this module source. File Systems are an advanced topic that are more suited for IDE Editor enhancements. Typically an empty string is returned.
function IOTACreator.GetOwner: IOTAModule; Returns the Module that will be the owner of the new object being created. For example if the object being created is a Form then the owner would be the Project. If the object being created is a Project Module then the owner would be the Project Group.
function IOTACreator.GetUnnamed: Boolean; By returning true the IDE will show the Save As.. dialog box when the user tries to save the object for the first time.
IOTAModuleCreator function GetAncestorName: string; Returns the Ancestor that the Form will be derived from. If you return an empty string the IDE will substitute the default name for the ancestor of the particular Creator Type. For instance in the following snippet of code the Ancestor name is "Form".
TForm1 = class(TForm) This means you have control over what Form class your Form Creator descends from. The make a decedent of TDataModule you would return Result := 'DataModule'; from this method. The same hold for any custom TForms that are registered with the IDE. This is a very powerful and useful method. In the NewImplSource and NewIntfSource methods this will be the name that is passed in the AncestorIdent parameter.
function GetImplFileName: string; Return a fully qualified file name of the implementation source that already exists. This is exactly like the IOTAProjectCreator.GetFileName method with the same warnings. Similar to this:
function GetIntfFileName: string; Return a fully qualified file name of the interface source that already exists. The same warning that are discussed in GetImplFileName apply.
function GetFormName: string; Returns the name that will be used for the Form. If you return an empty string the IDE will substitute the default name for the particular Creator Type For instance in the following snippet of code the Form name is "Form1".
TForm1 = class(TForm) In the NewImplSource and NewIntfSource methods this will be the name that is passed in the FormIdent parameter.
function GetMainForm: Boolean;
If this is to be the main top level form for
the application then return True, if it is a secondary form or one
that is to be creating dynamically return false. function GetShowForm: Boolean;
When the IDE creates the Form there are two
items that it can show, one is the source code for the file and the
other is the actual Form that can be designed. This is the flag to
inform the IDE if it should show the actual Form to the user. function GetShowSource: Boolean;
When the IDE creates the Form there are two
items that it can show, one is the source code for the file and the
other is the actual Form that can be designed. This is the flag to
inform the IDE if it should show the source code to the user. function NewImplSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile; This is where the source for the Form is added. Again if you are using a standard Creator Type return a nil, see IOTACreator.GetCreatorType, if GetCreatorType is returning an empty string you must return a valid IOTAFile interface or you will get an AV. For a default Form Module the parameters could be:
For a default Unit Module the parameters could be:
The actual source code is not written in the method. It is done indirectly in IOTAFile.GetSource implementation.
function NewIntfSource(const ModuleIdent, FormIdent, AncestorIdent: string): IOTAFile;
This is where the source for the interface is added. Again if you are using a standard Creator Type return a nil, see IOTACreator.GetCreatorType, if GetCreatorType is returning an empty string you must return a valid IOTAFile interface or you will get an AV. The actual source code is not written in the method. It is done indirectly in IOTAFile.GetSource implementation.
procedure FormCreated(const FormEditor: IOTAFormEditor);
Called after the Form Module has been created.
Notice the object has been created and a valid IOTAFormEditor is sent
as a parameter. Here components may be added to to Form using the interface.
Once the Form Creator is implemented the Form File need attention.
|
Last Modified on: |