输入无效时,Inno Setup Disable Next按钮 [英] Inno Setup Disable Next button when input is not valid

查看:117
本文介绍了输入无效时,Inno Setup Disable Next按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当输入不是"Admin"时,我需要禁用 Next 按钮.

I need to disable Next button, when input is not "Admin".

类似的东西:

procedure EditKeyPress(Sender: TObject; var Key: Char);
begin
  { enable the next button if the value in the box is admin; disable otherwise }
  WizardForm.NextButton.Enabled:=InputPage6.values[EditIndex2]‌​.Text = 'Admin'
end; 

推荐答案

实施输入框OnChange事件.自定义页面激活后,您还需要确保按钮状态已更新.您可以为此使用OnActivate事件(或CurPageChanged事件函数).

Implement the input box OnChange event. You will also need to make sure the button state is updated, when the custom page is activated. You can use OnActivate event for that (or CurPageChanged event function).

var
  Page: TInputQueryWizardPage;

procedure ValidatePage;
begin
  WizardForm.NextButton.Enabled := (CompareText(Page.Values[0], 'Admin') = 0);
end;  

procedure EditChange(Sender: TObject);
begin
  ValidatePage;
end;

procedure PageActivate(Sender: TWizardPage);
begin
  ValidatePage;
end;

procedure InitializeWizard();
begin
  Page := CreateInputQueryPage(...);
  { To disable the Next button initially [when box is empty] }
  Page.OnActivate := @PageActivate;
  Page.Add(..., False);
  { Update Next button state on any input change (typing, copy&paste, whatever) }
  Page.Edits[0].OnChange := @EditChange;
end;


要合并多个验证,请参见使用多个验证表达式(当输入值与多个值之一匹配时),Inno Setup Disable Next按钮.

.

有关其他方法,请参见:

For other approaches, see:

  • Inno Setup - Create User Input Query Page with input length and format limit and use the input;
  • Validate data on custom page when Next button is clicked in Inno Setup.

这篇关于输入无效时,Inno Setup Disable Next按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆