FolderItem.ShowOpenFileDialog not firing

Has anyone else seen this?
Sometimes calling this does nothing at all. I just have to kill the running session and run again. Typically it will work the second try, but not always.

Is this known or should I be concerned?

What OS and version of Xojo? Can you provide a sample bit of code?

I used the following code and ran it 15 times without issue on macOS 10.14 in Xojo 2020r1.2:

var f as FolderItem = FolderItem.ShowOpenFileDialog("*")
break

Var f As FolderItem = FolderItem.ShowOpenFileDialog(filetypes.Pdf)

Mac OS 15.15.6
Xojo 2020 r 1.1

There isn’t much to it. I have it happening in two separate projects now.

Interesting. What’s the default folder that it’s opening to select from?

  1. Is your application Sandboxed?
  2. I’ve seen others report similar issues too. It appears that the preferences for the application (which govern open and save dialogs) can gt set to incorrect values. You can manually reset this using
    defaults remove <bundleID>

What’s worrying about #2, is that I have no idea of what caused this, so it’s likely to come back.

1 Like

Good question. I didn’t pass one.

I don’t think that’s it.
It happens maybe every few hours and a restart of the debugging session tends to clear it.
What I’m worried about is that it might happen in the final built all.

If the default is Documents or Desktop (maybe others) you need to have plist item on MacOS that tells the user why you want to access those folders, if you are missing that key it may be blocked. I suspect that that’s what you are seeing.

You can use this:
https://documentation.xojo.com/api/user_interface/desktop/openfiledialog.html

To set an inital folder you control. But you’d still need those plist keys if the user select such folder.

Documents folder:
https://developer.apple.com/documentation/bundleresources/information_property_list/nsdocumentsfolderusagedescription

Desktop folder:
https://developer.apple.com/documentation/bundleresources/information_property_list/nsdesktopfolderusagedescription

A list of all items for protected resources:
https://developer.apple.com/documentation/bundleresources/information_property_list/protected_resources

While that might be true, that’s not what’s going on here. If that were the case it wound’t work flawlessly 95% of the time.

Apple has some odd things, your debugrun is actually a started by xojo so i’m not sure if the plist is accepted from the debugrun or the one from xojo itself. But i’ve seen these issues also. File a bugreport, use something else and move on… MBS may help you here or use the alternative OpenFileDialog and try that.

I’m sorry to hijack a thread from a while ago, but I’m getting this behaviour in my app on Windows 7 SP1 (FolderItem.ShowOpenFileDialog does nothing under Windows 7 SP1). The call to ShowOpenFileDialog just returns immediately with no UI shown (or at least I can’t see it). It works fine under MacOS and Windows 10 but not on Windows 7. Unfortunately I can’t reproduce it in a small test app – that works too – so I guess it must be something to do with my app. But I can’t figure out what it is. I was wondering if anyone here has any suggestions?

Try deleting the app from the target machine where the remote debugger caches them. I don’t know why, but after I did this it stopped. Maybe coincidence.

Thanks Chris. It happens for new and upgraded installations on Windows 7 SP1 systems and also on a brand new Windows 7 SP1 ISO loaded into Parallels. I feel like it might be due to a recent change to one of the plugins that I’m using but haven’t been able to prove that yet.