RAD Studio VCL Reference
|
TSelectDirOpt and TSelectDirOpts determine how a directory selection dialog responds when the user enters a nonexistent directory.
TSelectDirOpt = ( sdAllowCreate, sdPerformCreate, sdPrompt );
enum TSelectDirOpt { sdAllowCreate, sdPerformCreate, sdPrompt };
The following table lists 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 you enter 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 you when the entered directory does not exist and asks if the directory should be created. If you choose 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. |
Delphi 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:\WINDOWS. 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: } uses FileCtrl; const SELDIRHELP = 1000; procedure TForm1.Button1Click(Sender: TObject); var Dir: string; begin Dir := 'C:\Windows'; if FileCtrl.SelectDirectory(Dir, [sdAllowCreate, sdPerformCreate, sdPrompt],SELDIRHELP) then Label1.Caption := Dir; end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|