2

I am adding a checkbox to my input query page to use it to show me the password uncovered, when is checked. But I don't know how to do that.

I already created the following procedure. But this procedure does not change me the true false value on add input. This procedure adds me new textbox that do the job.

Could you please help me?

procedure SPCheckBoxChecked(Sender: TObject);
begin
    if Assigned(SPCheckBox) then
  begin
    if SPCheckBox.Checked then
       CredentialsPage.Add('Password:', False)
    if not SPCheckBox.Checked then
       CredentialsPage.Add('Password:', True)
  end;
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Peter Star
  • 47
  • 5

1 Answers1

3

Use TPasswordEdit.Password property:

[Code]

var
  InputQueryPage: TInputQueryWizardPage;

procedure ShowPasswordCheckClick(Sender: TObject);
begin
  InputQueryPage.Edits[0].Password := not TNewCheckBox(Sender).Checked;
end;

procedure InitializeWizard();
var
  ShowPasswordCheck: TNewCheckBox;
begin
  InputQueryPage := CreateInputQueryPage(
    wpWelcome, 'Password prompt', 'Please enter your password', '');
  InputQueryPage.Add('Password:', True);

  ShowPasswordCheck := TNewCheckBox.Create(WizardForm);
  ShowPasswordCheck.Parent := InputQueryPage.Surface;
  ShowPasswordCheck.Top :=
    InputQueryPage.Edits[0].Top + InputQueryPage.Edits[0].Height + ScaleY(8);
  ShowPasswordCheck.Height := ScaleY(ShowPasswordCheck.Height);
  ShowPasswordCheck.Caption := '&Show password';
  ShowPasswordCheck.OnClick := @ShowPasswordCheckClick;
end;

enter image description here

enter image description here

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992