【发布时间】:2014-08-14 11:45:12
【问题描述】:
早上好,我在重写创建表单时遇到了这个问题,并且在我意识到错误引发异常类分段错误之前 depurei 应用程序时违反了 (11)。
Tfrm_cart.Create constructor (AOwnerr: TComponent; ptipo1: String; PID1: Integer);
begin
try
inherited Create (AOwnerr);
type: = ptipo1;
id: = PID1;
except
on e: Exception of
begin
ShowMessage (e.Message);
end;
end;
end;
并称之为
With frm_cart.Create (self, 'INC', 0) of
begin
frm_cart.Show;
Free;
End;
并在 Delphi 中自动创建表单。
有人知道吗??
【问题讨论】:
-
参见例如
this question。你应该写frm_cart := Tfrm_cart.Create(Self, 'INC', 0);,或with Tfrm_cart.Create(Self, 'INC', 0) do。附言不要在构造函数中吞下异常。 -
我还要添加 frm_cart.Show 将是非阻塞的,因此表单也会在它被绘制到屏幕上之前被销毁。很可能你只需要放弃免费的,因为你给了它一个所有者,以后会销毁它。
-
您发布的代码不是真正的代码,因为构造函数无法编译。请始终发布真实代码。
标签: android delphi delphi-xe6