Rui Almeida
Rui Almeida

Reputation: 11

How can I add "New Folder" button on TInputDirWizardPage

I have the code below and I need to give an option for the user create a new folder inside the one the user picked.

This option is not related with folder where the program is actually installed.

For example:
If the user have chosen a D:\, I want to give option for the user create a new folder like D:\code\ without leaving the installation itself.

var
  CodePage: TInputDirWizardPage;

procedure ChoseCodeFolder();                   
begin
  CodePage := CreateInputDirPage(wpSelectDir,
    'Select your Code Folder', 'Where should your code folder be located?',
    'Select the folder in which your projects be located, then click Next.',
    false, '');
  CodePage.Add('');
end;

I read the documentation several times and i cant understand how I can do that.

I hope the question is described clearly :)

Like this image:

new folder button

Upvotes: 1

Views: 353

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202340

Just pass a value (e.g. 'Code') to the ANewFolderName parameter:

CodePage := CreateInputDirPage(wpSelectDir,
  'Select your Code Folder', 'Where should your code folder be located?',
  'Select the folder in which your projects be located, then click Next.',
  false, 'Code');

See the documentation for CreateInputDirPage:

If AAppendDir is False and ANewFolderName is not empty, a Make New Folder button will be shown that creates a new folder with the specified default name.

Browser For Folder dialog

Upvotes: 1

Related Questions