OK, if THAT's the case, then I think you might be better served with a ListBox 
in any case, which has much better support for the TStrings.Objects property 
and is much easier to implement item/line reordering and deletion logic.

If you're determined to use a Memo, then I'd suggest storing the text and 
objects in a TStringList, which you then assign the strings to the Memo lines.

When the lines are reordered in or dropped from the Memo, then swap/drop the 
same numbered strings/objects in the TStringList.

Make sense?

Stephen Posey
stephenlpo...@earthlink.net 

-----Original Message-----
>From: John Barrat <j.bar...@netcom.co.uk>
>Sent: Dec 13, 2012 4:04 AM
>To: 'Moderated List for the Discussion of Delphi Programming
>       excluding       Database-related topics' <delphi@elists.org>
>Subject: RE: What is the best way to add objects to TMemo.Lines
>
>No the only things allowed are to re-order (drag and drop) and delete - I
>cannot see why that should affect the objects or am I missing something?
>
>JohnB
>
>-----Original Message-----
>From: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] On Behalf
>Of Stephen Posey
>Sent: 12 December 2012 15:12
>To: Moderated List for the Discussion of Delphi Programming excluding
>Database-related topics
>Subject: Re: What is the best way to add objects to TMemo.Lines
>
>Are you going to allow the text in the Memo to be edited? 
>
>If so, what are the implications for the associated objects if the number of
>lines changes (e.g. someone inserts a line break, types in one or more
>lines, or deletes one or more lines)?
>
>Stephen Posey
>stephenlpo...@earthlink.net 
>
>-----Original Message-----
>>From: John Barrat <j.bar...@netcom.co.uk>
>>Sent: Dec 11, 2012 11:38 AM
>>To: 'Moderated List for the Discussion of Delphi Programming
>>      excluding       Database-related topics' <delphi@elists.org>
>>Subject: What is the best way to add objects to TMemo.Lines
>>
>>I seems TMemo.lines only supports the String part of a TStrings not the 
>>Objects.
>>
>>TMemo.Lines.AddObject compiles fine in fact only the string component 
>>is actually loaded.
>>
>> 
>>
>>I need to store an object with this TMemo - how do you recommend I do this?
>>
>> 
>>
>>JohnB
>>
>>_______________________________________________
>>Delphi mailing list
>>Delphi@elists.org
>>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
>_______________________________________________
>Delphi mailing list
>Delphi@elists.org
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
>_______________________________________________
>Delphi mailing list
>Delphi@elists.org
>http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to