Есть пример программки с авторизацией, простейший.
Она, работает но проблема в том, что если откроется окно приветствие, то после закрытия его, форма закроется а приложение будит весеть в задачах.
В чем тут проблема?
Код:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class (TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
public
end ;
var
Form1: TForm1;
Const
login= 'vasya' ;
pass= 'pass' ;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1 . Button1Click(Sender: TObject);
begin
if (Edit1 . Text=login) and (Edit2 . Text=pass)
then
begin
Form2 . Show;
Form1 . Visible:= false ;
end
else
ShowMessage( 'Ошибка!' );
end ;
end .
|
Код:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class (TForm)
Label1: TLabel;
private
public
end ;
var
Form2: TForm2;
implementation
{$R *.dfm}
end .
|