Quick Look in OpenFileDialog now working in existing project

This is a weird one. I’m using Xojo 2022r1. When I use OpenFileDialog in my existing project the Quick Look accessed by right-clicking on a file brings up an empty Quick Look window saying “No items selected”. However, if I create a new project and use the exact same code, Quick Look works. I even tried an example from the docs, and it fails in this way in my existing project, too. I understand there may be a bug that was fixed in API2, but we should be able to mix API1 and API2 in existing projects. Here’s code from the LR that shows this. Does anyone have an explanation/workaround for this?

Var dlg As OpenFileDialog
Var f As FolderItem
dlg = New OpenFileDialog
dlg.PromptText = “Select a file”
f = dlg.ShowModal
If dlg.Result <> Nil Then
MessageBox("You selected: " + dlg.Result.NativePath)
// User Cancelled
End If

I do not understand the relationship you made from Xojo and Quick Look.

AFAIK, Quick Look is a macOS Feature.

If Quick Look knows nothing about Xojo, all it will gives you is like a Get Info on the file…

Get File Info

Quick Look.

That is in the Finder.

Monterey 12.3.1
MacBook Pro M1

Of course it’s a macOS feature, that’s why it’s posted in the macOS forum. In the Xojo OpenFileDialog you can select a file, right click on it, and choose Quick Look.

You could install our QuickLook extension for Xojo projects.

You don’t event have to right click. You should be able to click on a file and press the space bar. Which toggles quick view on and off.

Is the file type you are trying to view a stock type or one specific to your application.

That’s not the problem. The problem is that the OpenFileDialog running in Xojo isn’t allowing a Quick Look to appear when the user right-clicks on a file and choose Quick Look. I’ve also tried OpenDialogMBS, using your example code, and the same problem occurs. It works when I run your example, but not when it’s run in my project. I’ve trashed my .plist in case there was some issue there, but it didn’t help. I said it’s weird, it even effects MBS functions. It’s not only my Mac, BTW. The issue was reported by a user.

@Ian Kennedy I see the same problem when pressing Space. I’ve tried with multiple file types, Text files, PDFs, etc. The same for all. “No items selected”.

I suppose it is worth trying a quick FolderItem.ShowOpenFileDialog call to rule out any configuration options you may have selected with the configurable version?

Good idea, but no. I tried this

f = folderItem.ShowOpenFileDialog("")

Trying to bring up Quick Look in the dialog failed.

If I create a fresh project, it works.

I see the same behavior in a new project as well, “No items selected”. macOS 12.3.1 on a M1 Mini.

It works here for me, with a M1 Max MBP.

It it perhaps to do with what it is called from? For example is it called from a MenuItem or a DesktopMenuItem, a Button or a DesktopButton?

@anthony G. Cyphers
Since a new project works for me, I wonder if you’d be kind enough to file a feedback with your example project?

In my case, projects built a year or two ago fail, and that was well before Desktop controls appeared.

Could be worth adding a window to your project, convert just that window to API2 and try calling from there?

Data points:

Xojo 2022r1
M1 Mini
Big Sur 11.6.5
App is Application not DesktopApplication

var md as new OpenFileDialog
md.PromptText = "Select a file"
call md.ShowModal

Project file: Download OpenFileDialog.xojo_xml_project

Quick Look worked from the open dialog here.

@ian Kennedy

Good suggestion, but an OpenFileDialog called from an API2 window gives the same result, No items selected.

@Tim Parnell

Yes, your project works here, too (I’m in 10.14.5 on an Intel Mac). But so do new projects I create. It’s running in the existing project that’s the problem. The differences I can think of between the two is that

  1. The existing project is signed and hardened.
  2. The info.plist will be different.

But commenting out the signing code and trashing the info.plist didn’t help.

Which version of Xojo are you using?

Just thought it might be worth mentioning 2022r1 adds a signing step that caused me a lot of hassle regarding IPCSockets. After we worked out the issue, Xojo let me know they are focusing on correcting it for an upcoming release.

May or may not at all be related, but it does certainly sound like the open dialog doesn’t have permissions of some sort.

I’m using 2022r1. But this issue predates this. I have builds from older versions of Xojo that have the same problem. And as I said, when I remove the signing code the problem remains. @Anthony posted that he sees the same problem with a new project, which I assume is unsigned.

Tim’s project worked for me on an M1 Max MacBook Pro. I don’t have any signing certificates in place.

@Jonathan_Ashwell Could you make a copy of your project and strip it back to just the minimum required and share it, we could try it out?

The signing step I’m referring to cannot be removed. In the end for me to get IPCSockets working, I had to add a final-final signing step of my own to re-sign the whole package in a way that satisfied security.

Again, may not be related, but I think it’s valuable information because macOS security is a bit unpredictable.