【发布时间】:2018-12-14 17:40:05
【问题描述】:
我有以下代码(取自Use two/multiple selected directories from custom page in Files section):
[Code]
var
DirPage: TInputDirWizardPage;
function GetDir(Param: String): String;
begin
Result := DirPage.Values[StrToInt(Param)];
end;
procedure InitializeWizard;
var
S1, S2: String;
begin
S1 := SetupMessage(msgSelectDirDesc);
StringChangeEx(S1, '[name]', 'ProgramName', false);
S2 := SetupMessage(msgSelectDirLabel3);
StringChangeEx(S2, '[name]', 'ProgramName', false);
{ create a directory input page }
DirPage := CreateInputDirPage(
wpSelectDir, SetupMessage(msgWizardSelectDir), S1, S2, False, '');
{ add directory input page items }
DirPage.Add('Path to Apache:');
DirPage.Add('Path to PHP:');
DirPage.Add('Path to Server Files:');
{ assign default directories for the items from the previously stored data; if }
{ there are no data stored from the previous installation, use default folders }
{ of your choice }
DirPage.Values[0] := GetPreviousData('Directory1', 'C:\Apache');
DirPage.Values[1] := GetPreviousData('Directory2', 'C:\PHP');
DirPage.Values[2] := GetPreviousData('Directory3', 'C:\Apache\htdocs\Server Files');
end;
procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
{ store chosen directories for the next run of the setup }
SetPreviousData(PreviousDataKey, 'Directory1', DirPage.Values[0]);
SetPreviousData(PreviousDataKey, 'Directory2', DirPage.Values[1]);
SetPreviousData(PreviousDataKey, 'Directory3', DirPage.Values[2]);
end;
我想让它的行为类似于传统的文件夹选择页面,因此在选择文件夹时,Inno Setup 应保留默认文件夹名称,除非用户手动覆盖。即:如果我选择文件夹"C:\Program Files\",它应该保留原始文件夹,如"C:\Program Files\PHP" 或"C:\Program Files\Apache"。这可能吗?
【问题讨论】: