使用 IntraWeb (34) - TIWAJAXNotifier
2021-04-29 23:36
204 查看
使用 IntraWeb (34) - TIWAJAXNotifier
在异步事件中, 可以通过 TIWAJAXNotifier 发出一个通知(通过其 Notify 方法), 该通知会激发其 OnNotify 事件.
这一般用在: 当一个异步事件完成后, 立即处理随后的事情.
TIWAJAXNotifier 所在单元及继承链:
IWCompExtCtrls.TIWAJAXNotifier < TIWBaseHTML40Component < TIWBaseHTMLComponent < TIWBaseComponent < TComponent < TPersistent < TObject
主要成员:
property SendNotification: Boolean 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 (36) - TIWServerControllerBase
- 使用 IntraWeb (37) - TIWApplication
- 使用 IntraWeb (19) - 基本控件之 TIWTreeView
- 使用 IntraWeb (38) - TIWAppForm、TIWForm、TIWBaseHTMLForm、TIWBaseForm
- 使用 IntraWeb (39) - THttpRequest、THttpReply
- 使用 IntraWeb (18) - 基本控件之 TIWImage、TIWImageFile、TIWImageList
- 使用 IntraWeb (10) - CSS
- 使用 IntraWeb (8) - 系统模板
- 使用 IntraWeb (7) - 主模板
- 使用 IntraWeb (6) - 页面模板: TIWLayoutMgrHTML、TIWTemplateProcessorHTML
- 用户离职后如何删除其个人视图(Personal View)?
- 使用 IntraWeb (5) - 页面布局之 TFrame
- 使用 IntraWeb (4) - 页面布局之 TIWRegion
- IntraWeb XIV 类型速查表
- 使用 IntraWeb (11) - 基本控件之 TIWButton
- 使用 IntraWeb (13) - 基本控件之 TIWLabel、TIWLink、TIWURL、TIWURLWindow
- 使用 IntraWeb (3) - 页面切换
- 使用 IntraWeb (14) - 基本控件之 TIWHRule、TIWRectangle
- 使用 IntraWeb (15) - 基本控件之 TIWEdit、TIWMemo、TIWText
- 使用 IntraWeb (17) - 基本控件之 TIWRadioButton、TIWRadioGroup、TIWCheckBox