如何解决我如何在Delphi中向这种数组添加项目?
我有一个名为apps的变量,我认为它是一个动态数组:
apps2 = array of app3;
app3 = class(TRemotable)
private
Fname_: appNameType;
Fid: appIdType;
published
property name_: appNameType Index (IS_UNQL) read Fname_ write Fname_;
property id: appIdType Index (IS_UNQL) read Fid write Fid;
end;
我有一个类inititateTechnicalRegistration,我必须将一些值传递给它的apps属性。我该怎么办?
initiateTechnicalRegistration_Type = class(TRemotable)
private
FpartnerName: partnerNameType;
FpartnerOrganizationIdentifier: partnerOrganizationIdentifierType;
Fapps: apps2;
Fapps_Specified: boolean;
Fdescription: descriptionType;
Fdescription_Specified: boolean;
FcontactEmail: contactEmailType;
FrequestedRole: Array_Of_roleType;
FpublicKey: string;
FpartnerAddress: partnerAddressType;
FpartnerAddress_Specified: boolean;
FpartnerURL: partnerURLType;
FpartnerURL_Specified: boolean;
procedure Setapps(Index: Integer; const Aapps2: apps2);
function apps_Specified(Index: Integer): boolean;
procedure Setdescription(Index: Integer; const AdescriptionType: descriptionType);
function description_Specified(Index: Integer): boolean;
procedure SetpartnerAddress(Index: Integer; const ApartnerAddressType: partnerAddressType);
function partnerAddress_Specified(Index: Integer): boolean;
procedure SetpartnerURL(Index: Integer; const ApartnerURLType: partnerURLType);
function partnerURL_Specified(Index: Integer): boolean;
public
constructor Create; override;
destructor Destroy; override;
published
property partnerName: partnerNameType Index (IS_UNQL) read FpartnerName write FpartnerName;
property partnerOrganizationIdentifier: partnerOrganizationIdentifierType Index (IS_UNQL) read FpartnerOrganizationIdentifier write FpartnerOrganizationIdentifier;
property apps: apps2 Index (IS_OPTN or IS_UNQL) read Fapps write Setapps stored apps_Specified;
property description: descriptionType Index (IS_OPTN or IS_UNQL) read Fdescription write Setdescription stored description_Specified;
property contactEmail: contactEmailType Index (IS_UNQL) read FcontactEmail write FcontactEmail;
property requestedRole: Array_Of_roleType Index (IS_UNBD or IS_UNQL) read FrequestedRole write FrequestedRole;
property publicKey: string Index (IS_UNQL) read FpublicKey write FpublicKey;
property partnerAddress: partnerAddressType Index (IS_OPTN or IS_UNQL) read FpartnerAddress write SetpartnerAddress stored partnerAddress_Specified;
property partnerURL: partnerURLType Index (IS_OPTN or IS_UNQL) read FpartnerURL write SetpartnerURL stored partnerURL_Specified;
end;
initiateTechnicalRegistration = class(initiateTechnicalRegistration_Type)
private
published
end;
所以我想在运行时或通过其他可能的方式从某些TEdit传递一些值,但是我以前从未使用过这类变量,我该怎么做?
initiateTechnicalRegistration1.apps:=
解决方法
在代码之后,是用于将项目添加到Apps数组的方法:
// Function return the index allocated in the array
function TForm1.AddApp(Value: App3): Integer;
begin
Result := Length(FApps);
SetLength(FApps,Result + 1);
FApps[Result] := Value;
end;
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。