Recent

Author Topic: TPicture sugestion.  (Read 4493 times)

Prime

  • Jr. Member
  • **
  • Posts: 67
TPicture sugestion.
« on: November 11, 2006, 11:42:58 pm »
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 :-

Code: [Select]

    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.

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2671
RE: TPicture sugestion.
« Reply #1 on: November 14, 2006, 10:57:42 am »
Can you file a feature request in mantis (=bug tracker) ?
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018