From DataFlex Wiki
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: 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:

Commercial alternatives

There's the CodeJock alternative: