unit Form_Auth;
interface
uses
Windows,
Graphics,
Classes,
Forms,
Dialogs,
StdCtrls,
Datenbank,
Funktionen_Login;
type
TAuth_Form =
class(TForm)
private
procedure Auth_Button_Click(Sender: TObject);
procedure Auth_Key_Press(Sender: TObject;
var Key: Char);
procedure Auth_Form_Destroy(Sender: TObject);
public
procedure Auth_Form_Create(Sender: TObject);
end;
var
Auth_Form : TAuth_Form;
Auth_PN : TEdit;
Auth_Button : TButton;
implementation
procedure TAuth_Form.Auth_Form_Create(Sender: TObject);
begin
Auth_Form := TAuth_Form.Create(
nil);
Auth_PN := TEdit.Create(Auth_Form);
Auth_Button := TButton.Create(Auth_Form);
Auth_Form.Caption := '
PN';
Auth_Form.
Name := '
Login';
Auth_Form.Width := 166;
Auth_Form.Height := 75;
Auth_Form.Position := poScreenCenter;
Auth_Form.BorderStyle := bsDialog;
Auth_Form.OnDestroy := Form_Auth.Auth_Form.Auth_Form_Destroy;
Auth_PN.Parent := Auth_Form;
Auth_PN.
Name := '
Auth_PN_Edit';
Auth_PN.Text := '
';
Auth_PN.Left := 5;
Auth_PN.Top := 5;
Auth_PN.Width := 110;
Auth_PN.MaxLength := 8;
Auth_PN.Font.Size := 14;
Auth_PN.Font.Style := [fsBold];
Auth_PN.OnKeyPress := Form_Auth.Auth_Form.Auth_Key_Press;
Auth_Button.Parent := Auth_Form;
Auth_Button.Left := 119;
Auth_Button.Top := 5;
Auth_Button.Width := 30;
Auth_Button.Height := 30;
Auth_Button.Caption := '
OK';
Auth_Button.OnClick := Form_Auth.Auth_Form.Auth_Button_Click;
try
Auth_Form.ShowModal;
finally
Auth_Form.Free;
end;
end;
procedure TAuth_Form.Auth_Form_Destroy(Sender: TObject);
begin
If Form2.Login_State = False
then ExitProcess(0);
end;
procedure TAuth_Form.Auth_Button_Click(Sender: TObject);
begin
If Length(TEdit(Auth_Form.FindComponent('
Auth_PN_Edit')).Text) = 8
then
begin
Form2.Username := TEdit(Auth_Form.FindComponent('
Auth_PN_Edit')).Text;
Funktionen_Login.Login;
end
Else Showmessage('
Bitte gültige PN eingeben!');
If Form2.Login_State = True
then Auth_Form.Close;
end;
procedure TAuth_Form.Auth_Key_Press(Sender: TObject;
var Key: Char);
begin
If not (Key
in ['
0'..'
9', Char(VK_BACK)])
then Key := #0;
end;
end.