onexit事件:delphi组件常用的一个事件
焦点从表格上移到窗体上的其他控件中时触发该事件
delphi语法
propertyonexit:tnotifyevent
描述
onenter事件和onexit事件是成对出现的,焦点移到表格上时触发onenter事件,当焦点移出时触发onexit事件,通过响应这两事件可以作出一些特殊的效果。
比如有焦点时选择框颜色为天蓝色,没有焦点时选择框变成黄色,可以通过一下代码实现:
proceduretform1.gridenter(sender:tobject);
begin
grid.selectcolor:=clskyblue;
end;
proceduretform1.gridexit(sender:tobject);
begin
grid.selectcolor:=clyellow;
end;