TAdvStringGrid
Example 13 : Combining TAdvStringGrid and TWebData to build a quote download application
This project shows how to load data from the Web into a grid.

This code snippet constructs the TWebData item to retrieve for a single quote:
ScanFirst := 'quotes delayed 15 min';
ScanFrom:='';
ScanTo:='';
URL:='http://moneycentral.msn.com/scripts/webquote.dll?iPage=lqd&Symbol='+qgrid.cells[1,i];
Once the collection is filled with URLs and search specifiers, it can be started to collect the information with or without a thread:
if checkbox1.checked then webdata1.ThreadCollectData else webdata1.CollectData;
Different TWebData events are used to update the user interface:
OnData event:
procedure WebData1Data(sender: TObject; iItem: Integer; data: String);
This event is triggered after each value is retrieved, it fills the grid cell with the value retrieved.
OnProgress event:
procedure WebData1Progress(sender: TObject; iItem: Integer);
This event is triggered after a value is retrieved and can be used to drive a progress bar.
OnCollectDone event:
procedure WebData1CollectDone(sender: TObject);
This event is triggered when all items have been retrieved.
As demonstrated in this sample, TAdvStringGrid & TWebData together allow to create a stock quote collecting application with minimal effort.
Delphi project & source files for downloading included in the main demos distribution for Delphi.
×