Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 6 of 6 total |
Type Record and array of Type record |
Mon, Aug 27 2012 1:13 PM | Permanent Link |
Franck - Midi pyrénées - France Esteves Ducilia | Hello,
Is it possible to declare a type of Record and use it to create a array of this type. type // Declare a customer record TCustomer = Record firstName : string[20]; lastName : string[20]; address1 : string[100]; address2 : string[100]; address3 : string[100]; city : string[20]; postCode : string[8]; end; var customers : array of TCustomer; |
Mon, Aug 27 2012 2:23 PM | Permanent Link |
Raul Team Elevate | I don't believe there are records in EWB but you can just use a class
type TPersonRec = class public firstName:string; lastName:string; Age:integer; //other fields end; and then var arrCustomers : array of TPersonRec; and then you could do something like SetLength(arrCustomers ,10); arrCustomers [0] := TPersonRec.Create; arrCustomers [0].firstName := 'John'; .... You can use it like this which would be closest to record or add some actual properties and functions to the class and hide the implementation completely from outside code. Raul On 8/27/2012 1:13 PM, Franck wrote: > Hello, > > Is it possible to declare a type of Record and use it to create a array of this type. > > type > // Declare a customer record > TCustomer = Record > firstName : string[20]; > lastName : string[20]; > address1 : string[100]; > address2 : string[100]; > address3 : string[100]; > city : string[20]; > postCode : string[8]; > end; > > var > customers : array of TCustomer; > |
Mon, Aug 27 2012 2:31 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Franck,
<< Is it possible to declare a type of Record and use it to create a array of this type. >> No, you have to use a class instead, like this: type // Declare a customer record TCustomer = class firstName : string[20]; lastName : string[20]; address1 : string[100]; address2 : string[100]; address3 : string[100]; city : string[20]; postCode : string[8]; public // properties that read/write the variables go here end; var customers : array of TCustomer; You'll have to make sure to create/dispose of the objects properly also. You should probably consider using the TObjectList class for this - it will be the easiest way of dealing with such a list: http://www.elevatesoft.com/manual?action=viewcomp&id=ewb1&comp=TObjectList If you have any other questions, please let me know. Tim Young Elevate Software www.elevatesoft.com |
Tue, Jun 17 2014 11:48 AM | Permanent Link |
Aleksid1 | Hi,
Do you plan to add support of records in future version? Yes, I know that we can use class, but use of records are much simplier. And our old code from Delphi uses records in many modules. type TCustomer = Record firstName : string[20]; lastName : string[20]; end; |
Tue, Jun 17 2014 7:10 PM | Permanent Link |
Steve Gill | Hi Aleksid1,
<< Do you plan to add support of records in future version? >> I use records extensively in Delphi but use TObjectList in EWB. If I'm not mistaken, I believe Tim said on a previous occasion that the reason it hasn't been added is because Javascript doesn't have a record type. - Steve |
Wed, Jun 18 2014 3:01 AM | Permanent Link |
Aleksid1 | Hi Steve,
Thanks for your reply! I thought that it's possible to emulate records in Javascript. |
This web page was last updated on Friday, November 1, 2024 at 07:01 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |