I am a little puzzled about two things I have found about TStringList, it would be nice if someone can confirm this is expected behavior.
1. If you sort the list, the Sorted property is not set to true. HelpNote is a TStringList and EBox is/are Instances of a Form. Thus -
HelpList.AddObject(HelpNoteName, EBox);
HelpList.Sort;
showmessage('List is sorted ' + booltostr(HelpList.Sorted, true)); // this says False
HelpList.Find('Some Name', SomeInt); // This generates an exception
The messagebox says 'False' and Find raises an exception because the list is not sorted. If you set the property to True, it all behaves as expected. In fact, after the call to .Sort it is is sorted, should Sorted set the Sorted property ?
Secondly, and I find this very convenient but want to know if I can depend on it -
HelpList.AddObject(NoteNoteName, EBox1);
HelpList.AddObject(NoteNoteName, EBox2);
HelpList.AddObject(NoteNoteName, EBox3);
After this little run, HelpList will contain just one entry (not three) and it's object is EBox3. Like I said, that suits me perfectly but can I rely on that behavior ?