![]() |
|
|
|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
|
Опции темы | Поиск в этой теме | Опции просмотра |
|
|
|
#1
|
|||
|
|||
|
Есть пример программки с авторизацией, простейший.
Она, работает но проблема в том, что если откроется окно приветствие, то после закрытия его, форма закроется а приложение будит весеть в задачах. В чем тут проблема? Код:
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
{ Private declarations }
public
{ Public declarations }
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.Код:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
Label1: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
end. |
|
#2
|
|||
|
|||
|
Ну правильно. Ты же главную форму просто прячешь.
Вообще, если у тебя есть форма входа, то она не должна быть главной формой приложения. |
|
#3
|
|||
|
|||
|
надо как-то так
в файле проекта Код:
begin FormInit:=TFormInit.Create(nil); //<<==-- FormInit.Show; //<<==-- FormInit.Update; //<<==-- Application.CreateForm(TMainForm, MainForm); Application.CreateForm(TForm2, Form2); Application.CreateForm(TForm3, Form3); Application.CreateForm(TForm4, Form4); Application.CreateForm(TForm5, Form5); MainForm.Update; //<<==-- FormInit.Free; //<<==-- Application.Run; end. |