Inno Setup Disable Next button using multiple validation expressions (when input value matches one of multiple values)

梦想与她 提交于 2019-12-08 18:32:38

If I understand you correctly, you are asking how to combine multiple logical expressions into one. Use boolean operators, particularly and operator.

procedure ValidatePage;
begin 
  WizardForm.NextButton.Enabled :=
    (CompareText(InputPage6.Values[EditIndex2], 'EX12345') <> 0) and
    (CompareText(InputPage6.Values[EditIndex2], 'EX54321') <> 0);
end;

Particularly if you are going to add even more options, you can optimize the code by storing the value into a local variable first:

procedure ValidatePage;
var
  Value: string;
begin 
  Value := InputPage6.Values[EditIndex2];

  WizardForm.NextButton.Enabled :=
    (CompareText(Value, 'EX12345') <> 0) and
    (CompareText(Value, 'EX54321') <> 0);
end;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!