How to display hidden files in a open files dialog box?

Thank you, I think I’m considering buying the pack in the short term.

Hi @Christian_Schmitz

#1 : I try it OpenDialogMBS in “MBS Util Plugin” but the dialog box don’t show the files, made invisible with Xojo’s “Visible = true” function, they are displayed as normal files because they do not have a “.” (dot) before their name !
#2: Does MBS have a function to add a dot point (".) in front of the name of a file/folder?
Thanks very much

I am not having an issue with OpenDialogMBS and showing invisible items. This is working as expected:

var f as FolderItem = SpecialFolder.Desktop.Child("test")
f.CreateFolder
f.Visible = false

var o as new OpenDialogMBS
o.ShowHiddenFiles = true

call o.ShowDialog

Do you have a better description of what you’re expecting and what’s actually happening?

#2: Does MBS have a function to add a dot point (".) in front of the name of a file/folder?

A plugin for that would be overkill.

var f as FolderItem = // wherever you acquire the folderitem
f.Name = "." + f.Name
1 Like

You need to set Folderitem.Visible to false to hide files.

If a file called RED has been made invisible but doesnt have a . at the front, the filename is still RED

If you literally change the filename by adding a . so that it becomes .RED you may well break something that expects to find a file called RED
Dont do that.

If you want the file selector to show a (not really there) ‘.’ in front of the word RED, you will need to write one yourself.

If you want hidden files to show up and be selectable, then the file name the user is choosing is RED and you are choosing for it not to matter to them if the file is set to be visible or not.

Next time, please post in the Targets/MacOS channel. It is much easier for others to help.

Actually, it is there.

It was not there an hour ago, maybe OP moved the topic or one of the mods.

Ok. Would be nice to have the forum showing moves.

By the way, this thread talks about listing hidden files without a plugin or declares:

If you want to do all this without plugins, I put together a pair of classes and put them here:

1 Like

Hello @Christian_Schmitz
I wasn’t clear enough about my point :slight_smile:
Invisible files displayed in “OpenDialogMBS” are not grayed out and therefore how to differentiate them from visible files? This makes their selection very difficult in large cases in particular. Finder and even ForkLift and others gray out invisible files for easier viewing (see screenshots attached). Can we remedy this?
View hidden files with OpenDIalog MBS

View hidden files with ForkLift for exemple

That is a feature of Finder, not the system file selector (NSOpenPanel)

Here’s the same thing written in obj-c:

This looks logical to me, as open dialogs already grey out files that aren’t of an accepted type.

We have an event for that:

OpenDialogMBS.FilterItem(file as folderitem, filterMode as Integer) as boolean

So you can disable items based on your own decision.

Yes, you could grey out invisible files like those not accepted from the filters already do, using that event, but my point is: the dialogs are already greying out filtered items (those whose the filters aren’t matching), so if one wants to show invisible, yet accepted, files, but grey them out, better to not show them in the first place, otherwise they are just greyed out like others.

1 Like

So, I wonder, can we go so far as to display only the invisible files in the boxes in the “OpenDialogMBS” (Files) or/and “NSOpenPanelMBS” (Folders) dialog box ?
Thank you for your patience :sweat_smile:

You can’t show only invisible files in these dialogs, as visible files will always be shown. However, you may grey out all visible files and enable all invisible files.

You said “However, you may grey out all visible files and enable all invisible files.”
Yes, that’s exactly what I want to do. But how to formulate the filters params with “OpenDialogMBS .FilterItem” and the opposite, on the other side (gray out all invisible files and enable visible files).
By default (without filters) visible and invisible are enabled !

OpenDialogMBS .FilterItem(file as folderitem, filterMode as Integer) as boolean

1 Like

Given a filter that allows all files to be selected (or no filter at all), you then use the FilterItem event to allow only invisible files.
Something like this in the FilterItem event:

if file<>nil and file.visible then return true //Disable a visible file