Hi,
I've been playing with loading and viewing graphics file in Lazarus, and currently I'm going the following :-
have the user select a folder, and read the names of the files in that folder into a TStringList. Then on my form I have a couple of buttons that allow the user to step backwards and farwards through the images and view them.
Currently I have code such as this to catch invalid image formats :-
TRY
CurrentImage.LoadFromFile(FileList.Strings[FileIdx]);
EXCEPT
StatusBar.SimpleText:=Format('Error loading %s not a valid image',[FileList.Strings[FileIdx]]);
Exit;
END;
What I would like to be able to do, is test the names when reading the directory, and only add the valid images to the TStringlist.
There is functionality in picture.inc to do this but it is not exported and therefore not usable to my code (unless I'm missing something, which is a posibility

).
So can I sugest something like a function called IsValidGraphicFile, that takes the pathname as a parameter and returns a boolean which is true if the file is valid and false otherwise.
Alterantly is there a way of doing this currently ?
I have just checked the ImageView demo, and that cheats by keeping it's own list of supported types, the disadvantage of this is that if additional types are added to the LCL, then they won't be automatically supported, without modifying this local lsit.
Cheers.
Phill.