试一下
if Achievementfm=nil then
Application.CreateForm(TAchievementfm, Achievementfm);
Achievementfm.ShowModal;
在Achievementfm里有一按钮创建子窗口
if Virtuefm=nil then
Application.CreateForm(TVirtuefm, Virtuefm);
Virtuefm.ShowModal;
Achievementfm.Close;在Virtuefm里有一按钮创建子窗口
if Achievementfm=nil then
Application.CreateForm(TAchievementfm, Achievementfm);
Achievementfm.ShowModal;
Virtuefm.Close;
if Achievementfm=nil then
Application.CreateForm(TAchievementfm, Achievementfm);
Achievementfm.ShowModal;
在Achievementfm里有一按钮创建子窗口
if Virtuefm=nil then
Application.CreateForm(TVirtuefm, Virtuefm);
Virtuefm.ShowModal;
Achievementfm.Close;在Virtuefm里有一按钮创建子窗口
if Achievementfm=nil then
Application.CreateForm(TAchievementfm, Achievementfm);
Achievementfm.ShowModal;
Virtuefm.Close;
if Achievementfm=nil then
Application.CreateForm(TAchievementfm, Achievementfm);时,
Achievementfm不会被创建,因此showmodal会出错。
另,窗口间跳转用hide&show不行吗?
1.在窗体的onclose中写 action:= cafree;
2.在窗体的ondestory中写 achievementfm:= nil;
但是如果在显示另一个窗口时使用了showmodal,那么原先的窗体就只有在showmodal返回,也就是被显示的窗体关闭时才回响应onclose和ondestory.于是上面的方法也不行了.一定要用showmodal吗?