【发布时间】:2010-03-23 18:24:40
【问题描述】:
有谁知道诀窍,如何在其事件处理程序中释放控制?根据delphi的帮助,这是不可能的......
当 Self.Text='' 时,我想释放动态创建的 TEdit。
TAmountEdit = class (TEdit)
.
.
public
procedure KeyUp(var Key: Word; Shift :TShiftState);
end;
procedure TAmountEdit.KeyUp(var Key: Word; Shift :TShiftState);
begin
inherited;
if Text='' then Free; // after calling free, an exception arises
end;
应该怎么做才能达到同样的效果?
感谢
【问题讨论】:
-
您是否尝试过启动一个计时器来释放编辑,然后自行禁用?
-
嗯...好问题。如果这是一个表单,我会调用 Release,但这是在 TCustomForm 上声明的,而不是在 TControl 或 TComponent 上。
-
好问题。过去我多次需要这样的东西。
标签: delphi