FileType Question SQLite types

   Dim dDialog as FolderItemDialog
  Dim fFolder as FolderItem
  
  dDialog = New OpenDialog
  
  dDialog.Title="Select a Database file"
  dDialog.Filter=FileTypes1.sql                  <========
  fFolder = dDialog.ShowModal()

I need an open dialog for the user to select a SQLite database file. It seems to work ok except that .sqlite files are grayed out in the open dialog so I can’t open a database. I added a line (manually, not using the drop down menu) in the FileType1 editor that has:

Display Name: database/sql Object Name: sql MacType: sqlite Extensions: .sqlite nothing else on the line

What have I done wrong??

thanks in advance all you fine folks.
bill

set mactype to ??? (exactly 4 question marks)
set maccreator to the same thing

also be aware SQLIte doesn’t "care what the extentions are… .DB, .FRED will be just as valid assuming the file is a valid SQLite format

Did as you recommended but now instead of the .sqlite files being grayed out, everything is available like no filter at all is in effect. I watched the debugger and the the .filter value pointed to database/sql.

what next?

thanks for helping.

did you leave the list of extensions?

the ??? tells OSX to ignore MacType/Creator and rely on the supplied extensions.

Works in all the projects I’ve used it in.

William:

I use sqlite as file extensions and a variation of:

Dim SQLiteType As New FileType jpegType.Name = "database/sqlite" // I do not recall jpegType.MacType = "????" // I do not recall jpegType.MacCreator = "????" // I do not recall jpegType.Extensions = ".sqlite"

I hope this help (I do not have my SQLite external hard disk with me right now).

William, the code as you described works just fine on Windows (which ignores MacType and MacCreator).

On Mac platforms, MacType and MacCreator should be exactly 4 characters with ‘???’ meaning “any type” or “any creator”. And you should specify both.

I’m not getting this. It does not filter. Of course I’ve tried so many different ways that I’ve probably got it mucked up pretty good. Here’s what I got. I used the File Types Set to create a file type and filled the fields in like this:

Display Name: SQLite
Object Name: SQLite
MacType: ???
MacCreator: ???
Extensions: sqlite

Then I create an OpenDialog with this filter: dlg.Filter=FileTypes1.SQLite

Code looks like this:

Dim dlg as OpenDialog dlg=New OpenDialog #If Not (TargetLinux) then dlg.InitialDirectory=f #Else //open Home directory on linux dlg.InitialDirectory=f #endif dlg.Title="Select a Database file" dlg.Filter=FileTypes1.SQLite //Defined as file type in FileTypes1. f=dlg.ShowModal()

Where am I getting this wrong? I’ve also tried defining a “pdf” file type and that doesn’t work either.

Thanks for any suggestions.

I have found that using “???” does not seem to work… and since those don’ seem to be “important” other than they have to exist
I use

Mactype=‘YYYY’
MacCreator=‘XXXX’

and you may have to designate a UTI (same as your bundle ID if you are on OSX)

Yea! That did it. Just changed the MacType and MacCreator codes per your example. Thanks!