Can't Open File my App creates

I’m on Mac OS 12.4 Xojo 2022.R1.1 on an Intel Mac

But this needs to work back to High Sierra and Windows 7-11

I am creating a custom file type and Saving the file. If I double click on the data file the app opens and opens the datafile just fine.

If however if I try to open the app with the Open Dialog class I can’t select the file… It is greyed out! How can if fix this besides allowing the file one to per any file and then checking if it is a .PLC after?

The Save and Open methods are show below… Both use the same File Set Filter!

Here is the save method:

Public Function Save(File as FolderItem = Nil) As Boolean
  If File Is NIL then
    Dim dlg As New SaveAsDialog
    dlg.InitialDirectory = App.Prefs.PLCFolder
    dlg.PromptText = "Save Fermentation Data"
    If Not (theData.DataFile Is NIL) then
      dlg.SuggestedFileName = theData.DataFile.Name
      dlg.Title = "Save Fermentation As"
      dlg.SuggestedFileName = theData.Title
      dlg.Title = "Save Fermentation"
    End if
    dlg.Filter = PLCFileSet.PLCSaved
    File = dlg.ShowModal
    If File Is Nil Then 
      Return False
    ElseIf File.Exists then 
    End if
  End if
  Return True
End Function

Here is the Open Method:

Sub Action() Handles Action
  Dim dlg As OpenDialog
  dlg = New OpenDialog
  dlg.InitialFolder = App.Prefs.PLCFolder
  dlg.Filter = PLCFileSet.PLCSaved
  dlg.ActionButtonCaption = "Select PLC File"
  dlg.CancelButtonCaption = "Cancel"
  dlg.SuggestedFileName = ""
  dlg.Title = "Select Saved PLC Data (.PLC) File(s)"
  dlg.PromptText = "Select Select Processed PLC File"
  dlg.MultiSelect = False
  Dim F as FolderItem = dlg.ShowModal
  If F is NIL Then Return
End Sub

is ‘.Name’ your filetype extension?

What extension does PLCFileSet.PLCSaved filetype have? If the saved file extension is not the same as the PLCFileSet.PLCSaved filetype extension, The open file dialog will not allow it to be selected to be opened.

The file name extension may be hidden by the macOS - use GetInfo to see the file’s name and extension to make sure it matches the PLCFileSet.PLCSaved filetype extension

I’ve been using filetypes defined in code since forever as the pre-defined filetypes don’t work:

Dim DBType As New FileType
dbType.Name = “vdb”
dbType.Extensions = “vdb”
theDialog.Filter = DBType

1 Like

No that is folderItem.Name

.PLC and it is right.

What may or not have the extension AFAIK is FolderItem.DisplayName. Folderitem.Name should always have it I think.

In any case looks like was a timing issue, Elsewhere Norm said (in part):

Nothing seems wrong in the apps I’ve seen this occur
The App’s plists are all OK and document types are OK

I truly have NO idea why it is this way - but I have seen it

One possibility is that spotlight & metadata indexing simply hasn’t completed and so it doesnt realize that the file can / should be openable

As it started working on it’s own, I think he is right


Actually they seem to. This was an oddball situation that resolved itself.