SelectDirectory (C++)
Description
This example uses a button and a label on a form. When you click the button, a Select Directory dialog box appears. The current directory displayed in the dialog box is C:\\Program Files\\CodeGear. You can select a directory from the directory list or enter a new directory in the edit box. If you enter a new directory, a message box asks you if the directory should be created. If you choose Yes, the directory is created. If you choose No, the message box disappears without creating the directory. The selected name of the directory appears as the caption of the label.
Code
#include "FileCtrl.hpp"
const SELDIRHELP = 1000;
void __fastcall TForm1::Button1Click(TObject *Sender)
{
String Dir = "C:\\Program Files\\CodeGear";
if (SelectDirectory(Dir, TSelectDirOpts() << sdAllowCreate << sdPerformCreate << sdPrompt,SELDIRHELP))
Label1->Caption = Dir;
}
Uses
- Vcl.FileCtrl.SelectDirectory ( fr | de | ja )
- Vcl.FileCtrl.TSelectDirOpts ( fr | de | ja )