xpher
asked on
FileListBox - Search - Sort
I am displaying filenames in FileListBox (obvious I suppose) my file names are peoples names ie MR A PERSON.jpg. I have no problem displaying without file extension but what I would like to do is have the list sorted alphabetically by surname (keeping name format same as above) and I would also like to search by surname and return item index.
I know this sounds like two questions in one but it is all tied together so I couldn't split.
Many thanks
Chris
I know this sounds like two questions in one but it is all tied together so I couldn't split.
Many thanks
Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Your getsurname function I don't quite follow. Bearing in mind that before the surname it could be
Mrs A Surname
Ms A Surname
Mr A Surname
A Surname
Chris
Mrs A Surname
Ms A Surname
Mr A Surname
A Surname
Chris
this function will work with all the cases you list and get the surname.
the sort will work on the surname only and not on the surname and first name in the same time
the sort will work on the surname only and not on the surname and first name in the same time
TMyFileListBox = class(TFileListBox)
protected
procedure ReadFileNames; override;
end;
procedure TMyFileListBox.ReadFilesNa
begin
inherited;
{Here you sort the list}
end;
And you could add your own method IndexOf or so to search on surname.
Christian