2012年9月21日 星期五

Using Open Directory Dialog Box in BCB



#include <FileCtrl.hpp>


    UnicodeString selDir;
    TSelectDirExtOpts opt;

    opt.Clear();
    opt += TSelectDirExtOpts()<<sdNewFolder;
    opt += TSelectDirExtOpts()<<sdShowEdit;
    opt += TSelectDirExtOpts()<<sdNewUI;

    if ( SelectDirectory( L"Please Select a Directory", L"", selDir, opt, this ) )
    {
        // the selected directory is stored in selDir;
    }



TSelectDirExtOpts is a set type, with elements of type TSelectDirExtOpt.  
The Options parameter of the SelectDirectory function is a set of type TSelectDirExtOpts. This parameter is used to specify the type of browse dialog box to create.  
The possible values for an element in a set of type TSelectDirExtOpts are given in the following table.
Option 
Meaning 
sdNewFolder 
Displays the Make New Folder button, when using the sdNewUI option. 
sdShowEdit 
Display an edit box containing the currently selected folder/file. This also allows typing the name of the folder/file to select. 
sdShowShares 
Shareable resources on remote systems are also displayed inside the browse dialog box. This automatically enables the option sdNewUI
sdNewUI 
Use the new type of dialog, that is sizeable and includes a Make a New Folder button. The dialog also allows dragging 
and dropping and using the context menu on either folders or files. 
sdShowFiles 
The browse dialog box also displays files. 
sdValidateDir 
Validates the name of the folder/file inserted into the edit box, when using the bifEditBox option. The validation triggers an event of type TBrowseForFolderCallbackEvent. 

沒有留言: