Closing the GetOpenFolderItem on a Mac

When I use GetOpenFolderItem on a Mac, the open dialog does not close after selecting the file. The code proceeds on, but the dialog box is still open . How do I get it to close?

Here is my code:
’ Reads Input Table (fIT)
Dim sType as New FileType
sType.Name = “text/csv”
sType.MacType = “TEXT”
sType.Extensions = “csv”

Dim fIT as FolderItem = GetOpenFolderItem(stype)
if fIT = Nil then
Return
end if

AFAIR this was mentioned a couple of times as feature from High Sierra. I don’t remember the solution. Does this happen during debugging or in a built app?

Debugging - I have a long way to go before this routine is ready for execution.

Did you tried the example from the documentation ?
(of course, changing the FileType)
Did you put your code in a simple PushButton of a brand new project ?

feedback://showreport?report_id=49730

Unfortunately, the bug isn’t fixed, yet. DO NOT do the workaround. Let the GetOpenFolderitem close and then do the debugging.

@Emile Schwarz : sigh…

This behavior was introduced by one of the internal graphics API changes – I don’t remember if it was with Sierra or High Sierra. If your code can be easily changed, simply jump to the return method via a Calllater call or similar and break there. The system needs some time to update the GUI which it did not in former macOS versions.

Ulrich, thanks for the suggestion but I am not at your level of programming. Could you give me some example code?

Here’s an example project that works with a delegate and a separate class:
https://drive.google.com/file/d/1yHjhQHv1HVuff_XIge2iCmLYaWXFUOs9/view?usp=sharing

You need to have one method that takes a folderitem as input parameter and pass its delegate ((Weak)AddressOf) to the constructor together with the GetOpen Filter:

Dim gui As New GUISavvyGetOpenFolderitem("", WeakAddressOf ProcessItem)

Once the dialog is closed, the method – in this case ProcessItem – will be invoked.

Thanks!