image image Home   About   Downloads   Support   Links   Contact  
image

IntraWeb
» Blog
» Trial Edition
» Bugs List
» IW XI Beta

Resources
» Documentation
» Get Your Key
» Articles
» Books
» Support

What others say
» Case Studies
» Magazine Reviews
» User Quotes






Copyright
2002 - 2010
Atozed Computer
Software Ltd.

image
Buy Online   Download Support  FAQ
Atozed Home  »  IntraWeb  »  IntraWeb Blog

XI: New component TIWAJAXNotifier

6/4/2010

In the latest XI release (11.0.9) we introduced the new component TIWAJAXNotifier.

The TIWAJAXNotifier brings a neat feature to IW XI. It is capable of notifying the application when a specific AJAX call was completed. After the AJAX call is completed, the OnNotify event (which also is an AJAX call) of the IWJAXNotifier is triggered and you can perform other tasks, as updating the Database, updating some progress information, etc.

See the sample AJAX call below. At the end of the code, we call IWAJAXNotifier1.Notify. It tells to IW to trigger a new AJAX call when the current one finishes execution.

procedure TIWForm2.ButtonTimeAsyncClick(Sender: TObject; EventParams: TStringList);
begin

  LabelTime.Caption := TimeToStr(Time);
  LabelTime.Visible := True;
  // this will send a notification to the IW AJAX core and a new AJAX call 
  // will be triggered when this AJAX call finishes

  IWAJAXNotifier1.Notify;
end
;

This is the OnNotify event of the TIWAJAXNotifier that is triggered when last AJAX call finishes execution.

procedure TIWForm2.IWAJAXNotifier1Notify(Sender: TObject);
begin

  LabelNotification.Caption :=
'Someone asked the current time and ' 
    +
'the answer was ' + LabelTime.Caption;
  LabelNotification.Visible := True;
end
;

You can have several copies of TIWAJAXNotifier in your IW Form that can be chained sequentially to update user interface with some progress information.

procedure TIWForm2.ButtonExecTasksAsyncClick(Sender: TObject; EventParams: TStringList);
begin

  DoTask;
  LabelTask1.Visible := True;
  IWAJAXNotifier3.Notify;
end
;

procedure TIWForm2.IWAJAXNotifier3Notify(Sender: TObject);
begin

  DoTask;
  LabelTask2.Visible := True;
  IWAJAXNotifier4.Notify;
end
;

procedure TIWForm2.IWAJAXNotifier4Notify(Sender: TObject);
begin

  DoTask;
  LabelTask3.Visible := True;
  IWAJAXNotifier5.Notify;
end
;

procedure TIWForm2.IWAJAXNotifier5Notify(Sender: TObject);
begin

  DoTask;
  LabelTask4.Visible := True;
end
;

The lines of code above shows the usage of the TIWAJAXNotifier chained performing some task and updating user interface at each task completion. See this demo on CodePlex.



<< Previous Entry    Next Entry >>



Comments:

-- No Comments --

Post a comment




CodeGear - Where Developers Matter