KCL Design System - Important Procedures and Functions
|
|
Version 1.00
|
KCL Design System provide you packs of procedures and functions
in several units to cooperate with the components and classes. Here we will
describe them briefly.
Unit
DfmLoader
This unit contains routines for I/O of DFM format files.
Procedures and Functions
function
ReadDFM(DfmStream: TStream; Instance: TComponent; DiscardClasses: TClassArray
= nil): TComponent; overload;
Read components from DfmStream
to Instance. If Instance is nil, a new component will be created and returned
as the result. The stream can be binary format or text format. You can "filter"
the stream by DiscardClasses to abandon the certain components/objects in
DfmStream.
function ReadDFM(DFMFileName:
string; Instance: TComponent; DiscardClasses: TClassArray = nil): TComponent;
overload;
Read components from a file to
Instance. If Instance is nil, a new component will be created and returned
as the result. The file can be binary format or text format. You can "filter"
the file content by DiscardClasses to abandon the certain components/objects.
procedure WriteDFM(DfmStream:
TStream; Instance: TComponent; BinFormat: Boolean = True; DiscardClasses:
TClassArray = nil); overload
;
Write Instance and all its childs
to DfmStream. You can specify the data format (binary or text) by BinFormat.
If DiscardClasses is not nil, these certain objects will not be written to
the DfmStream.
procedure WriteDFM(DFMFileName:
string; Instance: TComponent; BinFormat: Boolean = True; DiscardClasses:
TClassArray = nil); overload;
Write Instance and all its childs
to a file. You can specify the data format (binary or text) by BinFormat.
If DiscardClasses is not nil, these certain objects will not be written to
the file.
procedure FilterDfmStream(DfmStream:
TStream; DiscardClasses: TClassArray);
Filter the DfmStream and discard
all instances of DiscardClasses.
function IsBinFormatDFMStream(AStream:
TStream): Boolean;
Whether the stream is in binary
format.
procedure DFMStreamToBin(Input,
Output: TStream);
Convert text format stream Input
to binary format DFM stream Output.
procedure DFMFileToBin(InputFile,
OutputFile: TFileName);
Convert text format InputFile to
binary format DFM OutputFile.
Unit
MqyRTTI
This unit contains routines for RTTI (Run Time Type Infomation) operations.
Procedures and Functions
procedure GetClassPropertyNames(PTI:
PTypeInfo; AList: TStrings)
;
Fill AList with names of the
published property in class specified by PTI.
procedure GetParentClassNames(PTD:
PTypeData; Strs: TStrings);
Fill Strs with the ancestors'
name of class specified by PTD.
function IsComponentPTI(APTI:
PTypeInfo): Boolean;
Whether APTI specifys a TComponent.
procedure
ListEnumValues(Pti: PTypeInfo; Strs: TStrings);
Fill Strs with enumeration value
names of a type specified by PTI.
function PropInfoInComps(APPI:
PPropInfo; AComps: TObjectList): Boolean;
Whether the property specified
by APPI exists in all components in AComps.
function SetObjStrProp(Instance:
TObject; const PropName: string; const Value: string): Boolean;
Set Value to the the property
specified by PropName in Instance. The property type can be string, integer,
real, enumeration or set, but you can set their value in string format.
Unit
MqySysUtils
Procedures and Functions
procedure
CloneComponent(Src, Dest: TComponent);
Clone component form Src to
Dest. This procedure use RTTI and stream method, so you can use it on any
component that does not provide a "Assign" method. However, as the limination
of RTTI, it can only clone the published property values.
function
CompNameExists(AName: string; AOwner: TComponent): Boolean; overload
;
Whether a child of AOwner or
AOwner itself names with AName.
function
CompNameExists(AComp, AOwner: TComponent; IncludeSelf: Boolean = False):
TComponent; overload;
Whether a child of AOwner or
AOwner itself has the same name with AComp. If AComp is a child of AOwner,
you should set IncludeSelf to false, otherwise, the function will always
returns True.
function
GetUniqueName(ABaseName: string; AOwner: TComponent): string;
Generate a unique name based
on ABaseName. For example, if ABaseName is 'Label', and there is a control
in AOwner with the name 'Label1', the function will returns 'Label2'.
function
GetCompUniqueID(AClass: TComponentClass; AOwner: TComponent): string;
Generate a unique name for
a instance of AClass in AOwner. For example, if AClass is TLabel, and AOwner
already has two child names 'Label1' and 'Label2', the function will returns
'Label3'.
MQY Studio 2002.12