herculanojs Posted July 28, 2016 Share Posted July 28, 2016 FormLogin - How to avoid onshow event mainform if login fails I have the following problem. In onshow the mainform have some events. What happens is that if the login fails, this running these events. What I see is that even before validating the result of FormLogin the mainshow is already running. Is that so? procedure TfrLogin.btnOKClick(Sender: TObject); begin ModalResult := mrNone; if not DataModel.link.Util.ValidaSenha(edtsenha.Text,qryUsuario.FieldByname('senha').AsString) then begin inc(Tentativas); DataModel.link.Mensagem.Alerta('Acesso inválido, verifique a senha digitada.'); edtSenha.text := ''; edtSenha.SetFocus; exit; end; UniMainModule.Usuario.Codigo := qryUsuario.FieldByName('codigo').AsInteger; UniMainModule.Usuario.Nome := qryUsuario.FieldByName('nome').AsString; UniMainModule.Empresa.Codigo := qryEmpresa.FieldByName('codigo').AsInteger; UniMainModule.Empresa.Nome := qryEmpresa.FieldByName('nome').AsString; UniMainModule.Empresa.Fantasia := qryEmpresa.FieldByName('nomefantasia').AsString; ModalResult := mrOK; end; Quote Link to comment Share on other sites More sharing options...
herculanojs Posted July 28, 2016 Author Share Posted July 28, 2016 I do not want mainform to run while not pass the login Quote Link to comment Share on other sites More sharing options...
herculanojs Posted July 28, 2016 Author Share Posted July 28, 2016 I found out what it was. Was accessing a property in mainform, when accessed, it automatically processes the already show the form. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.