![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 21 to 24 of 24 total |
![]() |
Fri, May 1 2015 8:37 AM | Permanent Link |
Mark Brooks Slikware | "Tim Young [Elevate Software]" wrote:
>> It works like this: Tim. Seriously. Never received this quality of support anywhere else. Ever. Period. Respect and thanks. I am now on it. Mark. |
Fri, May 1 2015 9:26 AM | Permanent Link |
Matthew Jones | The support is superb, I agree.
What I'd like to see from this is a simple sample of an EWB class, some JSON, and the implementation that loads and saves it. Something that can then be adopted as the template by others who want to serialise in this way. I realise that's a big ask though. -- Matthew Jones |
Sat, May 2 2015 8:21 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Matthew,
<< What I'd like to see from this is a simple sample of an EWB class, some JSON, and the implementation that loads and saves it. Something that can then be adopted as the template by others who want to serialise in this way. I realise that's a big ask though. >> I put up an example project (it will be included with the release), that shows how to do the save/load: http://www.elevatesoft.com:8081/persistence/persistence.html Just modify the property values (without breaking the JSON, please ![]() then click on the Load Properties from Control button. Then you can click on the Copy buttons to test moving the property values back and forth. Use the Reset button to start over again. The code is pretty basic: TCustomer = class(TPersistent) private FCustomerID: String; FCompanyName: String; FAddress1: String; FAddress2: String; FCity: String; FStateProvince: String; FZipPostalCode: String; FCountry: String; FTerms: String; FNotes: String; FContact: String; FContactEmail: String; FContactPhone: String; published property CustomerID: String read FCustomerID write FCustomerID; property CompanyName: String read FCompanyName write FCompanyName; property Address1: String read FAddress1 write FAddress1; property Address2: String read FAddress2 write FAddress2; property City: String read FCity write FCity; property StateProvince: String read FStateProvince write FStateProvince; property ZipPostalCode: String read FZipPostalCode write FZipPostalCode; property Country: String read FCountry write FCountry; property Terms: String read FTerms write FTerms; property Notes: String read FNotes write FNotes; property Contact: String read FContact write FContact; property ContactEmail: String read FContactEmail write FContactEmail; property ContactPhone: String read FContactPhone write FContactPhone; end; ........ procedure TMainForm.CreateCustomers; begin Customer1:=TCustomer.Create; Customer2:=TCustomer.Create; end; procedure TMainForm.FreeCustomers; begin Customer1.Free; Customer1:=nil; Customer2.Free; Customer2:=nil; end; procedure TMainForm.InitializeCustomer1; begin Reader.Initialize(Cust1Props); // Cust1Props is a constant with the initial JSON values Customer1.Load(Reader); end; procedure TMainForm.InitializeCustomer2; begin Reader.Initialize(Cust2Props); // Cust2Props is a constant with the initial JSON values Customer2.Load(Reader); end; procedure TMainForm.LoadCustomer1; begin Reader.Initialize(Customer1Properties.Lines.Text); Customer1.Load(Reader); end; procedure TMainForm.LoadCustomer2; begin Reader.Initialize(Customer2Properties.Lines.Text); Customer2.Load(Reader); end; procedure TMainForm.SaveCustomer1; begin Writer.Initialize; Customer1.Save(Writer); Customer1Properties.Lines.Text:=Writer.Output; end; procedure TMainForm.SaveCustomer2; begin Writer.Initialize; Customer2.Save(Writer); Customer2Properties.Lines.Text:=Writer.Output; end; procedure TMainForm.MainFormCreate(Sender: TObject); begin Reader:=TReader.Create; Writer:=TWriter.Create; CreateCustomers; InitializeCustomer1; SaveCustomer1; InitializeCustomer2; SaveCustomer2; end; procedure TMainForm.MainFormDestroy(Sender: TObject); begin FreeCustomers; Reader.Free; Reader:=nil; Writer.Free; Writer:=nil; end; procedure TMainForm.LoadCustomer1ButtonClick(Sender: TObject); begin LoadCustomer1; end; procedure TMainForm.LoadCustomer2ButtonClick(Sender: TObject); begin LoadCustomer2; end; procedure TMainForm.Copy1To2ButtonClick(Sender: TObject); begin SaveCustomer1; Customer2Properties.Lines.Text:=Customer1Properties.Lines.Text; LoadCustomer2; end; procedure TMainForm.Copy2To1ButtonClick(Sender: TObject); begin SaveCustomer2; Customer1Properties.Lines.Text:=Customer2Properties.Lines.Text; LoadCustomer1; end; procedure TMainForm.ResetButtonClick(Sender: TObject); begin InitializeCustomer1; SaveCustomer1; InitializeCustomer2; SaveCustomer2; end; Tim Young Elevate Software www.elevatesoft.com |
Tue, May 5 2015 4:17 AM | Permanent Link |
Matthew Jones | Tim Young [Elevate Software] wrote:
> I put up an example project (it will be included with the release), > that shows how to do the save/load: I look forward to studying it in detail. -- Matthew Jones |
« Previous Page | Page 3 of 3 | |
Jump to Page: 1 2 3 |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |