Recent

Author Topic: [SOLVED] FilterIndex error when using CocoaUseUTIFilter := true;  (Read 2131 times)

apeoperaio

  • Full Member
  • ***
  • Posts: 231
I encountered an issue when using an OpenDialog and

CocoaUseUTIFilter := true;

https://wiki.freepascal.org/Cocoa_Internals/Dialogs#File_Type_Filters

If I use the same opendialog with different filters I get a List Index out of bounds.
I attached a sample project to reproduce the error. Steps to reproduce:
- compile and run the attached project;
- click on button1
- select a file and click open in the opendialog
- click on button2
- error raised

When executing the opendialog on button1 the opendialog has 2 filters and filterindex is set to 2.
When executing the opendialog on button2 the opendialog has only 1 filter.

The error is not raised if I set in Button2Click

OpenDialog1.FilterIndex:= 1

before

OpenDialog1.Execute

On Windows and Linux I do not need to reset the filterindex.

I do not get the error if
 CocoaUseUTIFilter := False;


My version is:
Lazarus 2.1.0 r65062M FPC 3.2.0 x86_64-darwin-cocoa
« Last Edit: October 19, 2021, 02:47:06 pm by apeoperaio »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2718
    • havefunsoft.com
Re: FIlterIndex error when using CocoaUseUTIFilter := true;
« Reply #1 on: October 18, 2021, 04:25:57 am »
should be fixed here

apeoperaio

  • Full Member
  • ***
  • Posts: 231
Re: [SOLVED] FilterIndex error when using CocoaUseUTIFilter := true;
« Reply #2 on: October 19, 2021, 02:47:21 pm »
Tested, it works!
Thank you.

 

TinyPortal © 2005-2018