RobYost Posted February 16, 2017 Share Posted February 16, 2017 The code below only gives me an error if I have more than one session that uses the same frame fraTenantDetails. Do I have something declared that is used in multiple sessions? If so, where would I look? if (fraTenantDetails = nil) then fraTenantDetails := TfraTenantDetails.Create(self); fraTenantDetails.Align := alClient; fraTenantDetails.Parent := tsTenant; <===This line fails tsTenant is a TUniTabSheet fraTenantDetails is a TUniFrame Project raised exception class EAssertionFailed with message 'TUniSimplePanel.SetParent(): Parent.OwnerForm must be same as Self.OwnerForm (H:\Framework\uniGUI\Source\Core\uniGUIClasses.pas, line 4837)'. Quote Link to comment Share on other sites More sharing options...
RobYost Posted February 18, 2017 Author Share Posted February 18, 2017 I still don't know what to do about this. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted February 18, 2017 Administrators Share Posted February 18, 2017 What is owner of tsTenant? What is owner of fraTenantDetails? They both must be owned by same Form or Frame. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted February 18, 2017 Administrators Share Posted February 18, 2017 If I have more than one session that uses the same frame fraTenantDetails. How can this happen? Each session must have its own instance of fraTenantDetails. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted February 18, 2017 Administrators Share Posted February 18, 2017 fraTenantDetails Where above variable is declared? Quote Link to comment Share on other sites More sharing options...
RobYost Posted February 18, 2017 Author Share Posted February 18, 2017 unit fTenantDetails;interfaceuses ...type TfraTenantDetails = class(TUniFrame) pgTenantBottom: TUniPageControl; tsScheduledCharges: TUniTabSheet; UniSimplePanel1: TUniSimplePanel; sgRecurringCharges: TUniStringGrid; tsLease: TUniTabSheet; lblLeaseBegin: TUniLabel; dateLeaseBegin: TUniDateTimePicker; edtRoommateName: TUniEdit; edtRoommateAddress: TUniMemo; edtRoommateOther: TUniMemo; tsTenantNotes: TUniTabSheet; ... procedure UniFrameCreate(Sender: TObject); procedure pgTenantBottomChange(Sender: TObject); private procedure LoadScheduledCharges(); function rtnDateRangeDesc(StartDate, EndDate: TDate): string; public { Public declarations } end;var fraTenantDetails: TfraTenantDetails;implementation{$R *.dfm}uses Quote Link to comment Share on other sites More sharing options...
RobYost Posted February 18, 2017 Author Share Posted February 18, 2017 What is owner of tsTenant? What is owner of fraTenantDetails? They both must be owned by same Form or Frame. tsTenant is a tabsheet on the main form. This is created in the main form. procedure TfrmMain.LoadEntity(aNode: TUniTreeNode); begin ... if (fraTenantDetails = nil) then fraTenantDetails := TfraTenantDetails.Create(self); fraTenantDetails.Align := alClient; fraTenantDetails.Parent := tsTenant; { TODO 1: core dump } end; Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted February 18, 2017 Administrators Share Posted February 18, 2017 var fraTenantDetails: TfraTenantDetails; Problem is here. In uniGUI you should never use global variables. Make it a class variable instead of a global var. Quote Link to comment Share on other sites More sharing options...
RobYost Posted February 18, 2017 Author Share Posted February 18, 2017 When I moved fraTIncome: TfraTIncome; Public declarations area of (TfraTIncome) I couldn't figure out how to reference it. Do I add this? . function TfraTIncome: TfraTIncome;begin Result := TfraTIncome(UniMainModule.GetFormInstance(TfraTIncome));end; Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted February 18, 2017 Administrators Share Posted February 18, 2017 Simply put it in public area of Form which is creating it. MainForm for instance. Quote Link to comment Share on other sites More sharing options...
RobYost Posted February 18, 2017 Author Share Posted February 18, 2017 I had tried that, but I didn't realize I had another frame. It was the second one that was set globally, even though I had changed the first one. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.