FolderDialog: Difference between revisions

From DataFlex Wiki
Jump to navigationJump to search
m Added to Codejock category
 
Line 32: Line 32:


There's the CodeJock alternative: https://support.dataaccess.com/Forums/showthread.php?48195-Browse-for-folder&p=240350#post240350
There's the CodeJock alternative: https://support.dataaccess.com/Forums/showthread.php?48195-Browse-for-folder&p=240350#post240350
[[Category:Codejock]]

Latest revision as of 15:25, 2 March 2020

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

Commercial alternatives

There's the CodeJock alternative: https://support.dataaccess.com/Forums/showthread.php?48195-Browse-for-folder&p=240350#post240350