Recent

Author Topic: [SOLVED] dlgOpenPicture Filter Property, how to restrict file extensions.  (Read 2143 times)

Elmug

  • Hero Member
  • *****
  • Posts: 849
Hi everyone,

Windows 7, Lazarus 32 bit.

I am not getting to have the dlgOpenPicture to show only .bmp ,  .jpg, and .jpeg files only for loading an image into a TImage box.

By default I can load them just fine. But I want to refine the application so only the three above file types show.

I have tried at filter, using the Filter editor:

Filter name = Graphic(*.bmp, *.jpeg, *.jpg)
Filter = *.bmp, *.jpeg, *.jpg

which loads into the Filter Property this:

----------------------------------------------------------------
Graphic (*.bmp, *.jpeg, *.jpg)|*.bmp, *.jpeg, *.jpg
----------------------------------------------------------------

When the dialog runs, actually no files at all show, only subfolders.

Any help on this will be appreciated.

Thanks


« Last Edit: August 02, 2012, 10:57:08 pm by Elmug »

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: dlgOpenPicture Filter Property, how to restrict file extensions.
« Reply #1 on: August 02, 2012, 10:56:47 pm »
SOLVED:

The delimiters are actually to be semicolons, and not commas. The small letters can throw anyone.

If any one needs the same, or similar, here's what to put in the Property box:

--------------------------------------------------------------
Graphic (*.bmp; *.jpeg; *.jpg)|*.bmp; *.jpeg; *.jpg
--------------------------------------------------------------

Then the dialog will only show subfolders, and files with the above extensions.

The word "Graphic" can be whatever.



eny

  • Hero Member
  • *****
  • Posts: 1634
Re: dlgOpenPicture Filter Property, how to restrict file extensions.
« Reply #2 on: August 02, 2012, 10:58:23 pm »
Maybe an incompatibility of Lazarus with the windows ListSeparator in your regional settings.
I guess yours is set to a comma.
Try replacing the comma with the semicolon ( ; ) like so and also remove the spaces (not sure why you have them):
Code: [Select]
Graphic (*.bmp; *.jpeg; *.jpg)|*.bmp;*.jpeg;*.jpg
Maybe that solves it.

[[edit]]
Note to self: type faster next time.
« Last Edit: August 02, 2012, 11:00:06 pm by eny »
All posts based on: Win10 (Win64); Lazarus 2.0.10 'stable' (x64) unless specified otherwise...

 

TinyPortal © 2005-2018