RAD Studio VCL Reference
|
TSelectDirOpts and TSelectDirOpt determine how a directory selection dialog responds when the user enters a nonexistent directory.
TSelectDirOpts = set of TSelectDirOpt;
TSelectDirOpt TSelectDirOpts;
These are the possible values that can be added to the set of options:
Value |
Meaning |
sdAllowCreate |
An edit box allows the user to type in the name of a directory that does not exist. This option does not create a directory: the application must read the name of the selected directory and create it if desired. |
sdPerformCreate |
Used only in combination with sdAllowCreate. If the user enters a directory name that does not exist, the directory selection dialog creates it. |
sdPrompt |
Used only in combination with sdAllowCreate. Displays a message box that informs the user when the entered directory does not exist and asks if the directory should be created. If the user chooses OK, the directory is created if the option set includes sdPerformCreate. If the option set does not include sdPerformCreate, the directory is not created: the application must read the directory name and create it. |
C++ Examples:
/* This example uses a button and a label on a form. When the user clicks the button, a Select Directory dialog box appears. The current directory displayed in the dialog box is C:\\Program Files\\CodeGear. The user can select a directory from the directory list, or enter a new directory in the edit box. If the user enters a new directory, a message box asks the user if the directory should be created. If the user chooses Yes, the directory is created. If the user chooses No, the message box goes away without creating the directory. The name of the directory the user selects appears as the caption of the label: */ #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; }
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|