GetFolder() in Windows

This is kind of an “out there” question, but I find the GetOpenFolder() dialog that REAL/Xojo puts up in AFAIK any Windows OS as being kind of restricted.

By that I mean that getting to a folder deep in a folder hierarchy is not easy, comparing to other ways of doing it. You have to scroll down, click triangles carefully so the expanded folders under it - which often position themselves in a way where you have to scroll again, and then you have to select it, etc.

Also, and I know Windows has it’s own rules, but if you pass Nil to the InitialFolder parameter, the dialog doesn’t come back to the last position, at least not most of the time. On OSX there is some type of persistence where it does - plus you have at least 4 “last accessed” entries. On Windows you don’t even have the “Recent Places” thing Explorer gives you. And the “default” place it comes back to always expands the C: drive, so you usually have to collapse it you want to effectively look at another drive.

I know REAL/Xojo uses “the standard” dialog, but is there a way (other that force-programming by using static FolderItems etc.) to access an expanded dialog that has better features? I swear I’ve seen this with other programs, where “Browse Folder” is more heavy-duty.

You could use OpenDialog which allows you to set an InitialDirectory, if you know what it will be.

Right, I know, but my question was beyond that; that is, is there a way to access a “more capable dialog” or creating more capability out of that standard dialog per the desires mentioned above.

To broaden the answer - I program cross platform. When I have a function that (typically) asks for a folder, on OSX it naturally without IntialDirectory goes to the last folder looked for in context. In other words, there’s some background intelligence to it. So as a rule I pass Nil to the InitialDirectory method, because if you specify it on OSX, you confuse that intelligence somewhat. Also, it’s not good programming to assume something on a user, that you want the last folder selected the last time they ran the function. I COULD, but I want to do things right.

But on Windows it’s different, and I don’t like #ifdef more than I have to either.

A related question if my question isn’t answered in the positive: Why doesn’t Microsoft add to their standard GetFolder() dialog? Like posting one of those textfields that autocomplete paths for you? Or a textfield where you can copy-paste in a path and it drills down for you? Or is that just Win8? I really don’t see this much if at all in Win7 or prior. For GetFile() you have options. GetFolder(), no.

[quote=183342:@Garth Hjelte]Right, I know, but my question was beyond that; that is, is there a way to access a “more capable dialog” or creating more capability out of that standard dialog per the desires mentioned above.

To broaden the answer - I program cross platform. When I have a function that (typically) asks for a folder, on OSX it naturally without IntialDirectory goes to the last folder looked for in context. In other words, there’s some background intelligence to it. So as a rule I pass Nil to the InitialDirectory method, because if you specify it on OSX, you confuse that intelligence somewhat. Also, it’s not good programming to assume something on a user, that you want the last folder selected the last time they ran the function. I COULD, but I want to do things right.

But on Windows it’s different, and I don’t like #ifdef more than I have to either.

A related question if my question isn’t answered in the positive: Why doesn’t Microsoft add to their standard GetFolder() dialog? Like posting one of those textfields that autocomplete paths for you? Or a textfield where you can copy-paste in a path and it drills down for you? Or is that just Win8? I really don’t see this much if at all in Win7 or prior. For GetFile() you have options. GetFolder(), no.[/quote]

Garth, you are looking for a feature that is not native to Windows. The notion of “last opened folders” is not currently implemented in Windows. Not even in Windows 10 The closest is the “last open documents”, and one could fetch their containing folders, but I do not know how to get that list. A quick look on the internet is inconclusive.

Maybe you could maintain your own list of places where you saved and roll your own file picker dialog with all the bells and whistles you wish like autocomplete…

Garth, I’m not sure exactly what you are trying to accomplish so excuse me if I get this wrong. It seems to me that you are wanting to open the dialog pointing to the last directory the user accessed in that method/routine. And I infer that there may/will be multiple places where the dialog is called, each wanting to recall its last directory. Is that the case?

If so, I would create a dictionary containing the CurrentMethodName:LastPath pair, updated each time the user hits that dialog in a particular method. You can look up the LastPath value for the particular method and feed that to the InitialDirectory parameter before calling the dialog.

Like Michel said, I just don’t think there is a native Windows functionality for this.