RAD Studio VCL Reference
|
Creates an instance of a data module and registers with the global screen object.
constructor CreateNew(AOwner: TComponent; Dummy: Integer = 0); virtual;
virtual __fastcall TDataModule(TComponent * AOwner, int Dummy = 0);
Use CreateNew instead of Create to create a data module without using the associated .form file to initialize it.
The first argument, AOwner, is the owner of the data module (usually the application). The second argument, Dummy, defaults to 0 and is not used by this constructor. The system passes 0 by default if this constructor is passed only the first argument, AOwner.
CreateNew bypasses the streaming in of the previously associated form file. Therefore, you must stream in an external form file to bind the visual components with their classes. You can stream in the previously associated form file by calling InitInheritedComponent. To stream in a different form file, bracket the call to CreateNew with calls to WriteComponentResFile and ReadComponentResFile. The following code sequence
WriteComponentResFile('Temp.xfm', DataModule1); ...
DataModule2 := TDataModule.CreateNew(Application);
ReadComponentResFile('Temp.xfm', DataModule2);
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|