SelectFolderDialog returns nil when selecting special folders in left pane

on a german Windows 7 system a SelectFolderDialog returns nil when I select one of the following folders in the left pane/list (see image) of the dialog: “Bilder”, “Dokumente”, “Musik” and “Videos”.
Is this a bug or did I do something wrong?

Example code:

Dim dlg as New SelectFolderDialog
Dim f as FolderItem

f = dlg.ShowModalWithin(Self)

If (f = Nil) then
Msgbox(“f = nil!”)
end if[/code]

SP 1 ?
In the IDE ?

yes, Windows 7, 64 Bit, SP1. Running from the IDE.

Hi Christian,

Did you try the usual suspects (like clear the Xojo Cache / Plane Mode, shut down the computer, Power ON, load only Xojo, load the project, run) ?

Sometimes, this helps.

At last, you can just remplace ShowModalWithin(Self) with ShowModal();
also, just put that code in a brand new project and run.

BTW: you cannot select anything with that code, so you have to click in Cancel and get the f = nil! message.

Sorry, I do not have a PC handly, so I tested that on my MacBook Pro (2015r1 was running).

If those folders don’t have a path, but are just virtual shell objects, it must return nil.

MBS Plugin Open Dialog does the same.

Hello Emile,
thanks for you suggestions.
The code works correctly on Mac. On Windows it really returns nil when I select one of the mentioned folders in the left pane but it returns a valid/correct path, if I select the same folders in the right side of the dialog. I tried the code with Xojo Version 2015.3.1 and a freshly installed version of the most current version of Xojo - both times the dialog returns nil. Interestingly I can select every other folder in the left pane and the dialog return a valid/correct path.
On thing I obeserved is that when selecting one of these folders (for example "Dokumente“) in the right pane, then the path that the dialog returns actually is “…\User home folder\Documents”. So it seems that some localisation is involved in this process.

Hello Christian,
maybe that could be the cause. The Windows computers are configured by the IT department so maybe they have added those things. I will check the next time I am at work.

Same apply to the macOS side. I can access to the Downloads folder using that name of Téléchargements (the French name); my installed macOS uses French.

I build a project for Windows and run the application on Windows 10 (up to date / current)…
No left pane at all.

Sorry, I cannot help more (nor better: no Windows 7 here, only XP and 10).

[quote=339521:@Emile Schwarz]
Sorry, I cannot help more (nor better: no Windows 7 here, only XP and 10).[/quote]

Hello Emile, thanks for trying to help.

After some more research Christian seems to be right. The selected folders that return nil are virtual folders in the so called „Libraries“ (German: „Bibliotheken“) in Windows. Here I found a short Explanation:
Because I am a Mac user I did not know about this feature. At least now I can explain the users of the Windows version of my app why selecting that entries in the left pane does not work.

I have run into this same issue … selecting a “virtual folder” (e.g., Documents, Pictures, Music, Video) returns Nil with the following code:

[code]Dim dlg As New SelectFolderDialog
dlg.ActionButtonCaption = “Select”
dlg.Title = “Title Property”
dlg.PromptText = “Prompt Text”
dlg.InitialDirectory = SpecialFolder.Documents

Dim f As FolderItem
f = dlg.ShowModal
If f <> Nil Then
// Use the folderitem here
// User cancelled
End If[/code]

I can understand Christian’s answer but where does that leave the user who doesn’t know that those “virtual folders” are not “real” folders from which they can select? I guess a better question would be, “How do I present a select folder dialog box to the user to select a folder where all the selections available in the box are ‘real’ folders and not the ‘virtual’ ones”??? I can’t expect the user to know the difference.