Incidently Brian, where do you live ? ----- Original Message ----- From: Brian Wrigley <[EMAIL PROTECTED]> To: Multiple recipients of list delphi <[EMAIL PROTECTED]> Sent: Friday, November 01, 2002 1:51 PM Subject: Re: [DUG]: Control has no owner
> ----- Original Message ----- > From: "Alistair George" <[EMAIL PROTECTED]> > To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> > Sent: Friday, November 01, 2002 9:06 AM > Subject: [DUG]: Control has no owner > > > > A moot case now as I found another solution but could it be clarified why > the > > below is not right and what would be right: > > > > > > procedure TMainform.VETclearchecks; > > var tempstr: tmemo; > > begin > > tempstr := tmemo.Create(self); file://I'm not doing this right here > > tempstr.Clear; > > VET.BeginUpdate; > > try > > VET.Storage.CheckedFileNames := tempstr.Lines; > > VET.RefreshTree; > > finally > > VET.EndUpdate; > > tempstr.Free; > > end; > > end; > > > > AND > > > > procedure TMainform.VETclearchecks; > > var tstring:tstrings; > > begin > > tstring:=tstringlist.Create; > > VET.BeginUpdate; > > try > > VET.Storage.CheckedFileNames := tstring; > > VET.RefreshTree; > > finally > > VET.EndUpdate; > > end; > > tstring.Free; > > end; > > James has already give the answer to the question you asked, i.e. that a > TMemo wants to be on a form and you wouldn't usually just create one on the > fly, use it in code and then free it. But you may be creating another > problem for yourself: > > You've created a list of strings temporarily and assigned it to some > property within the VET thingy. If VET.storage is copying the strings into > an internal object when you set the CheckedFileNames property that may be > fine, but if it uses the list directly you may be setting yourself up for an > access violation later. You have assigned > CheckedFileNames to an object which you have subsequently freed. Is > CheckedFileNames left holding a pointer to that now non-existent object? > What happens if you call VET.RefreshTree again? > > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/