在设置 {app} 之前获取 wpSelectDir 中的路径 Inno Setup
Get the path in the wpSelectDir before {app} is set Inno Setup
我想获取安装目录的路径,当用户单击 Next 时,当我在 wpSelectDir
Inno Setup 中时。
我需要检查路径,因为我需要验证路径,如果不正确,我不会让用户继续。
我的问题是常量{app}
还没有设置,因为它将在wpSelectDir
之后设置,而我还在。
你可以这样做....
procedure onDirChange(Sender: TObject);
var
currentDir: String;
begin
currentDir := WizardForm.DirEdit.Text;
// your validation goes here....
end;
procedure InitializeWizard;
begin
WizardForm.DirEdit.onChange := @onDirChange;
end;
WizardForm.DirEdit.Text
returns DirEdit
文本框中的当前值。每当 dirEdit 文本框中的文本更改时,都会调用过程 onDirChange
。您可以使用此值来执行验证。
使用WizardDirValue
support function:
Returns the current contents of the edit control on the Select Destination Location page of the wizard.
Unlike ExpandConstant('{app}')
, this function will not fail if called after the wizard is shown but prior to the user selecting a directory. Rather, it will return the default directory name.
它比 WizardForm.DirEdit.Text
更加地道。
虽然在内部它几乎是一样的:
RemoveBackslashUnlessRoot(WizardForm.DirEdit.Text)
另见
我想获取安装目录的路径,当用户单击 Next 时,当我在 wpSelectDir
Inno Setup 中时。
我需要检查路径,因为我需要验证路径,如果不正确,我不会让用户继续。
我的问题是常量{app}
还没有设置,因为它将在wpSelectDir
之后设置,而我还在。
你可以这样做....
procedure onDirChange(Sender: TObject);
var
currentDir: String;
begin
currentDir := WizardForm.DirEdit.Text;
// your validation goes here....
end;
procedure InitializeWizard;
begin
WizardForm.DirEdit.onChange := @onDirChange;
end;
WizardForm.DirEdit.Text
returns DirEdit
文本框中的当前值。每当 dirEdit 文本框中的文本更改时,都会调用过程 onDirChange
。您可以使用此值来执行验证。
使用WizardDirValue
support function:
Returns the current contents of the edit control on the Select Destination Location page of the wizard.
Unlike
ExpandConstant('{app}')
, this function will not fail if called after the wizard is shown but prior to the user selecting a directory. Rather, it will return the default directory name.
它比 WizardForm.DirEdit.Text
更加地道。
虽然在内部它几乎是一样的:
RemoveBackslashUnlessRoot(WizardForm.DirEdit.Text)
另见