我在主窗口的 onshow 里
procedure Tmainform.FormShow(Sender: TObject);
begin
if call=1 then
begin
loginform.ShowModal;
if loginform.ShowModal=mrok then
begin
if dbform.ADOTable1.Locate('username',usernamec,[]) and dbform.ADOTable1.Locate('userpws',userpwsc,[]) then
begin
loginform.Close;
end
else
begin
messagebox(handle,'密码错误,请重新输入','提示',mb_ok);
exit;
end
end;
call:=2;
end
else exit
end;
是为了让主窗口只有在第一次show的时候才 显示登录窗口 ,这样做是因为在主窗口里以后还要被其他窗口show 所以我定义了 全局变量call
但是为什么 ?
我在loginform 要点两次 mrok按钮才显示mainform 啊
谁知道我感谢他啊
procedure Tmainform.FormShow(Sender: TObject);
begin
if call=1 then
begin
loginform.ShowModal;
if loginform.ShowModal=mrok then
begin
if dbform.ADOTable1.Locate('username',usernamec,[]) and dbform.ADOTable1.Locate('userpws',userpwsc,[]) then
begin
loginform.Close;
end
else
begin
messagebox(handle,'密码错误,请重新输入','提示',mb_ok);
exit;
end
end;
call:=2;
end
else exit
end;
是为了让主窗口只有在第一次show的时候才 显示登录窗口 ,这样做是因为在主窗口里以后还要被其他窗口show 所以我定义了 全局变量call
但是为什么 ?
我在loginform 要点两次 mrok按钮才显示mainform 啊
谁知道我感谢他啊
begin
if call=1 then
begin
loginform.ShowModal;
if loginform.ShowModal=mrok then
begin
if dbform.ADOTable1.Locate('username',usernamec,[]) and dbform.ADOTable1.Locate('userpws',userpwsc,[]) then
begin
loginform.Close;
call:=2;//这里加上这个试试......
end
else
begin
messagebox(handle,'密码错误,请重新输入','提示',mb_ok);
exit;
end
end;
call:=2;
end
else exit
end;