FolderDialog

From DataFlex Wiki
Revision as of 16:51, 6 May 2019 by Wil (talk | contribs) (Created page with "=== OpenDialog for folders === The windows OpenDialog as is supplied by DataFlex is only for selecting files, not folders. It can be abused for that, but it tends to be a ve...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

OpenDialog for folders

The windows OpenDialog as is supplied by DataFlex is only for selecting files, not folders. It can be abused for that, but it tends to be a very confusing user interface.

There's not really an existing component for that in DataFlex.

You can use the vShBrowseForFolder function in the vWin32fh library. This function wraps the Windows API browseforfolder function.

What that misses out on though is that you cannot set the initial folder location on which to open the windows dialog.

The reason for that is that the Windows API requires you to use a callback function to set the initial folder. This cannot be done from within DataFlex as it is at this moment.

The solution then is to write a little DLL wrapper that offers this functionality via an alternative means. The control I wrote here: http://support.dataaccess.com/Forums/showthread.php?970-Open-File-Dialog is such a DLL and can be used freely.


Native DataFlex alternatives

There's alternatives that use only DataFlex code.

Advantage: no need to deploy anything else

Disadvantage: when Windows decides to change the style of the folder select dialog, yours will look different.


Vincent wrote a DataFlex variant here: A Folder Selector With Initial Folder Setting

Peter Crook wrote another DataFlex native variant which can be found here: https://support.dataaccess.com/Forums/showthread.php?54384-Browse-for-Folder