unit ULogin;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
UMain;
type
TFLogin = class(TForm)
btnLogin: TButton;
btnCancel: TButton;
btnOK: TButton;
edtUsername: TEdit;
edtPassword: TEdit;
lblMsg: TLabel;
lblUsername: TLabel;
lblPwd: TLabel;
procedure btnCancelClick(Sender: TObject);
procedure btnLoginClick(Sender: TObject);
private
public
end;
var
FLogin: TFLogin;
implementation
{$R *.lfm}
{ TFLogin }
procedure TFLogin.btnLoginClick(Sender: TObject);
begin
if (edtUsername.Text = 'admin') and (edtPassword.Text = 'admin') then
begin
self.ModalResult := mrOK; // Signal successful login
end
else
begin
ShowMessage('Wrong');
edtPassword.Clear;
edtPassword.SetFocus;
end;
end;
procedure TFLogin.btnCancelClick(Sender: TObject);
begin
ModalResult := mrCancel; // Or any other ModalResult that is not mrOk
Close;
end;
end.