码迷,mamicode.com
首页 > Web开发 > 详细

使用 IntraWeb (34) - TIWAJAXNotifier

时间:2014-06-25 13:33:25      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:class   ext   com   使用   string   os   


在异步事件中, 可以通过 TIWAJAXNotifier 发出一个通知(通过其 Notify 方法), 该通知会激发其 OnNotify 事件.

这一般用在: 当一个异步事件完成后, 立即处理随后的事情.

TIWAJAXNotifier 所在单元及继承链:
IWCompExtCtrls.TIWAJAXNotifier < TIWBaseHTML40Component < TIWBaseHTMLComponent < TIWBaseComponent < TComponent < TPersistent < TObject

主要成员:
property OnNotify: TNotifyEvent

procedure Notify


测试(需要 1 个 IWButton、4 个 IWLabel、3 个 IWAJAXNotifier):

{确保这是异步事件}
procedure TIWForm1.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList);
begin
  IWLabel1.Caption := TimeToStr(Time);
  IWAJAXNotifier1.Notify; //OnAsyncClick 执行到最后, 让 IWAJAXNotifier1 发出通知
end;

{IWAJAXNotifier1.OnNotify}
procedure TIWForm1.IWAJAXNotifier1Notify(Sender: TObject);
begin
  Sleep(1000);
  IWLabel2.Caption := TimeToStr(Time);
  IWAJAXNotifier2.Notify; //继续让 IWAJAXNotifier2 发出通知
end;

{IWAJAXNotifier2.OnNotify}
procedure TIWForm1.IWAJAXNotifier2Notify(Sender: TObject);
begin
  Sleep(1000);
  IWLabel3.Caption := TimeToStr(Time);
  IWAJAXNotifier3.Notify; //继续让 IWAJAXNotifier3 发出通知
end;

{IWAJAXNotifier3.OnNotify}
procedure TIWForm1.IWAJAXNotifier3Notify(Sender: TObject);
begin
  Sleep(1000);
  IWLabel4.Caption := TimeToStr(Time);
end;


使用 IntraWeb (34) - TIWAJAXNotifier,布布扣,bubuko.com

使用 IntraWeb (34) - TIWAJAXNotifier

标签:class   ext   com   使用   string   os   

原文地址:http://www.cnblogs.com/del/p/3806749.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!