我想把在form.close的时候执行自己写的一个过程
应该怎么办?
急!
应该怎么办?
急!
解决方案 »
- 按钮 OnClick 事件 为什么不执行?
- Delphi技术交流三群招人,顶者有分,QQ群:55792798
- vclskin 只要一用 opendialog或savedialog 就出现内存 "read of address 00000000" 错误
- 如何将数据库数据导入stringgrid中
- 在文本文件中按行写入数据和提取数据
- 怎么样才能把一个FORM上的所有COMPONENT都写到一个文件中,然后再读出来显示在FORM上呢?
- 有分大家得
- Delphi 中有没有FOR Each ... IN ... 语句?
- 如何让TImage控件picture全屏显示啊
- 如果得到网络上某一个文件的时间信息?
- 怎样让treeview中不同级的节点按不同的规则排序?
- 关于intraweb的问题了
是不是可以动态在 相应的form的onclose 事件的时候 响应 指定的procedure?
begin
showmessage('ok!');
end;
///***********
TEST.OnShow:= main.YdfFormShow;
TEST.Show;
可是效果好象不明显,是不是还有哪里有注意的?
谢谢
///.....with 你那个Form do
...//一些你的属性设置
onclose=myclose;
end;procedure myclose(Sender: TObject; var Action: TCloseAction)
begin
with (Sender as TForm) do
showmessage('ok');
end;应该就是这样你自己Try It
onclose=myclose;
为
onclose:=myclose;
误
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure myclose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.FormCreate(Sender: TObject);
begin
onclose:=Myclose;
end;procedure TForm1.myclose(Sender: TObject; var Action: TCloseAction);
begin
with (Sender as TForm) do
begin
showmessage('ok');
end;
end;end.
我这是写死的,如果你的Form是动态创建的也一样,
你在创建Form附属性值得时候,就把我在FormCreate下的
那句写进去就是了
然后,在你的代码中:form1.OnClose := MYfun(你自己定义的方法)就可以了!
你可以把winpro给ovrride 一下就可以了。请问你所说的ovrride,是不是就是onclose:=myonclose?
var
pp: TPoint;
i:integer;
begin
for i:=0 to listview1.Items.Count-1 do
begin
pp:=listview1.Items[i].GetPosition;
ORACLEDATASET1.Close;
ORACLEDATASET1.SQL.Clear;
oracledataset1.DeleteVariables;
ORACLEDATASET1.SQL.Add('update proinfo set px=:par2,py=:par3 where proname=:par1');
oracledataset1.DeclareVariable('par1',otstring);
oracledataset1.DeclareVariable('par2',otinteger);
oracledataset1.DeclareVariable('par3',otinteger);
oracledataset1.SetVariable('par1',listview1.items[i].caption);
oracledataset1.SetVariable('par2',pp.x);
oracledataset1.SetVariable('par3',pp.y);
oracledataset1.ExecSQL;
oraclesession1.Commit;
end;
end;