Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 11 to 12 of 12 total |
Accessing objects with name as string |
Thu, Feb 25 2016 5:20 PM | Permanent Link |
Matthew Jones | <Trinione> wrote:
> "Matthew Jones" wrote: > > << Probably best if you could post your real code, rather than my > contrived (edited down from a real dialog) code. >> > > Hi: > I receive 'Out of stack space ... Line 1' application error message when > I try to run this code. What am I doing wrong? > > procedure TfrmMain.Button1Click(Sender: TObject); > begin > if Not Assigned(frmTestGetSet) then > frmTestGetSet := TfrmTestGetSet.Create(nil); > > frmTestGetSet.Code := 999; > ShowMessage(IntToStr(frmTestGetSet.Code)); > end; > > > ////////// formTestGetSet ////////// > > type > TfrmTestGetSet = class(TForm) > procedure frmTestGetSetDblClick(Sender: TObject); > private > { Private declarations } > iCode: integer; > function GetCode: integer; > procedure SetCode(Code: integer); > public > { Public declarations } > property Code : integer read GetCode write SetCode; > end; > > var > frmTestGetSet: TfrmTestGetSet; > > implementation > > function TfrmTestGetSet.GetCode : integer; > begin > result := Code; > end; > > procedure TfrmTestGetSet.SetCode(Code: integer); > begin > iCode := Code; > end; > > Your getCode references the property not the member variable so it will recurse to stack death. -- Matthew Jones |
Thu, Feb 25 2016 8:43 PM | Permanent Link |
Trinione | << Your getCode references the property not the member variable so it will recurse to stack death. >>
And that it was. Thank you very much. Most appreciated! I have used both recommended solutions for various reasons already. |
« Previous Page | Page 2 of 2 | |
Jump to Page: 1 2 |
This web page was last updated on Wednesday, October 9, 2024 at 05:37 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |