Hi all,
I’m trying to create a password dialog box but it doesn’t seem to be returning the modal result correctly
On return Im testing for mrOK but I never seem to get mrOK returned
Can some one guide me on this
So the form is created such at runtime
procedure TConfig_Form.Test_Connect_BtnClick(Sender: TObject);
Var
The_Form: TPasswordDlg;
begin
try
The_Form := TPasswordDlg.Create(Self);
The_Form.Test := '12345';
The_Form.ShowModal;
if The_Form.ModalResult = mrOk then
Test_Connect_Btn.Caption := 'yes'
else
Test_Connect_Btn.Caption := 'no'; *<<<<<<< but I only ever seem to get this
finally
if Assigned(The_Form) then
FreeandNil(The_Form);
end;
end;
and in the password dialog box I have
procedure TPasswordDlg.OKBtnClick(Sender: TObject);
begin
if PASSWORD.Text = Test then
ModalResult := mrOk
else
ModalResult := mrNo;
Close;
end;
Thanks in advance
Grant