![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Product Manuals » Elevate Web Builder 3 Manual » Language Reference » Properties |
property <Property Name>: <Type Name> read <Variable Name>|<Method Name> [write <Variable Name>|<Method Name>] [default <Default Expression>] [description <Description>] [;default];
interface TCustomer = class private FID: Integer; FName: String; public property ID: Integer read FID write FID; property Name: String read FName write FName; end;
interface TCustomer = class private FID: Integer; FName: String; FModified: Boolean; procedure SetID(Value: Integer); procedure SetName(const Value: String); public property ID: Integer read FID write SetID; property Name: String read FName write SetName; property Modified: Boolean read FModified; end; implementation procedure TCustomer.SetID(Value: Integer); begin if (Value <> FID) then begin FID:=Value; FModified:=True; end; end; procedure TCustomer.SetName(const Value: String); begin if (not SameStr(Value,FID)) then begin FName:=Value; FModified:=True; end; end;
property <Property Name>[[const] <Parameter Name>: <Type Name>]: <Type Name> read <Array Variable Name>|<Method Name> [write <Array Variable Name>|<Method Name>]; [default;]
TCustomers = class private FCustomers: TObjectList; function GetCustomer(ID: Integer): TCustomer; public property Customer[ID: Integer]: TCustomer read GetCustomer; end;
var TempCustomers: TCustomers; begin TempCustomers:=TCustomers.Create(10); try ShowMessage(TempCustomers.Customer[2].Name); finally TempCustomers.Free; end; end;
TCustomers = class private FCustomers: TObjectList; function GetCustomer(ID: Integer): TCustomer; public property Customer[ID: Integer]: TCustomer read GetCustomer; default; end;
var TempCustomers: TCustomers; begin TempCustomers:=TCustomers.Create(10); try ShowMessage(TempCustomers[2].Name); finally TempCustomers.Free; end; end;
TCustomers = class private FCustomers: TObjectList; function GetCustomer(ID: Integer): TCustomer; function GetCustomer(const Name: String): TCustomer; public property Customer[ID: Integer]: TCustomer read GetCustomer; default; property Customer[const Name: String]: TCustomer read GetCustomer; default; end;
var TempCustomers: TCustomers; begin TempCustomers:=TCustomers.Create(10); try ShowMessage(TempCustomers[2].Name); ShowMessage(IntToStr(TempCustomers['Demo Customer #2'].ID)); finally TempCustomers.Free; end; end;
TMyClass = class private class FCreateCount: Integer; public constructor Create; override; class property CreateCount: Integer read FCreateCount; end; implementation constructor TMyClass.Create; begin inherited Create; Inc(FCreateCount); end;
procedure ShowCreateCount; var TempInstance: TMyClass; begin TempInstance:=TMyClass.Create; try ShowMessage(IntToStr(TempInstance.CreateCount)); finally TempInstance.Free; end; end;
procedure ShowCreateCount; begin ShowMessage(IntToStr(TMyClass.CreateCount)); end;
This web page was last updated on Thursday, November 16, 2023 at 10:39 AM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |