Port range validation for data input in Inno Setup

后端 未结 1 1085
伪装坚强ぢ
伪装坚强ぢ 2020-12-20 06:24

I try to set specific range of values that accepted from user inputs within installation. For example, port field just accept range from 10000-20000.

I try to use th

相关标签:
1条回答
  • 2020-12-20 07:11

    Just validate the input, display error message and make sure the NextButtonClick event function returns False:

    function NextButtonClick(CurPageID: Integer): Boolean;
    var
      ServerPortInt: Integer;
    begin
      Result := True;
      if CurPageID = AdminDataPage.ID then
      begin
        ServerPort := AdminDataPage.Values[3];
        ServerPortInt := StrToIntDef(ServerPort, -1);
        if (ServerPortInt < 10000) or (ServerPortInt > 20000) then
        begin
          MsgBox('Please enter port in range 10000-20000.', mbError, MB_OK);
          WizardForm.ActiveControl := AdminDataPage.Edits[3];
          Result := False;
        end;
      end;
    end;
    

    0 讨论(0)
提交回复
热议问题