In my project i created ActiveX Form.in that form i placed the string grid.my requirement is that,i have to show form ,in back ground data must inserted in to grid row by row .because of that user can think that .data is inserting.i created a thread in suspended mode.in execute method i wrote code to insert data.when i call thread.resume .it is executing the execute procedure.please tell me how to do that?
<pre lang="Delphi">
TMyThread = class(TThread)
private
Fparent:Tcomponent;
Fstream:Tmemorystream;
protected
procedure Execute; override;
public
constructor Create(CreateSuspended: Boolean);
procedure WlSetparams(parent:Tcomponent;stm:Tmemorystream);
procedure thrdWait();
procedure thrdWkup();
end;
procedure TMyThread.Execute;
var
colheaderlist :Tstringlist;
sd:Tstudy_details;
i:integer;
begin
inherited;
showmessage('cp1');
try
tdvsform(Fparent).AdvStringGrid1.Clear;
colheaderlist := TStringList.create;
colheaderlist.add('Select');
colheaderlist.add('Modality');
colheaderlist.add('ID');
colheaderlist.add('Name');
colheaderlist.add('Age');
colheaderlist.add('Sex');
colheaderlist.add('Study Date');
colheaderlist.add('Study ID');
colheaderlist.add('Study Desc');
colheaderlist.add('IMG_COunt');
colheaderlist.add('Memory');
colheaderlist.add('Performed Physician');
colheaderlist.add('Referring Physician');
colheaderlist.add('Accession No');
colheaderlist.add('StudyUId');
tdvsform(Fparent).AdvStringGrid1.ColumnHeaders := colheaderlist;
colheaderlist.Free;
sd:=TStudy_Details.create;
sd.loadfromstream(Fstream);
if (sd.Length_Record <> 0) then
begin
for i:= 1 to (sd.Length_Record) do
tdvsform(Fparent).AdvStringGrid1.AddRow;
for i:= 1 to (sd.Length_Record) do
begin
tdvsform(Fparent).AdvStringGrid1.Cells[1,(i)]:= sd.s1[(i-1)].P_Modality;
tdvsform(Fparent).AdvStringGrid1.Cells[2,(i)]:= sd.s1[(i-1)].P_ID;
tdvsform(Fparent).AdvStringGrid1.Cells[3,(i)]:= sd.s1[(i-1)].p_Name;
tdvsform(Fparent).AdvStringGrid1.Cells[4,(i)]:= sd.s1[(i-1)].P_Age;
tdvsform(Fparent).AdvStringGrid1.Cells[5,(i)]:= sd.s1[(i-1)].P_Sex;
tdvsform(Fparent).AdvStringGrid1.Cells[6,(i)]:= sd.s1[(i-1)].p_StudyDate;
tdvsform(Fparent).AdvStringGrid1.Cells[7,(i)]:= sd.s1[(i-1)].p_StudyID;
tdvsform(Fparent).AdvStringGrid1.Cells[8,(i)]:= sd.s1[(i-1)].p_StudyDescription;
tdvsform(Fparent).AdvStringGrid1.Cells[9,(i)]:= sd.s1[(i-1)].p_ImageCount;
tdvsform(Fparent).AdvStringGrid1.Cells[10,(i)]:= sd.s1[(i-1)].P_Memory;
tdvsform(Fparent).AdvStringGrid1.Cells[11,(i)]:= sd.s1[(i-1)].p_PerformedPhys;
tdvsform(Fparent).AdvStringGrid1.Cells[12,(i)]:= sd.s1[(i-1)].p_Referingphys;
tdvsform(Fparent).AdvStringGrid1.Cells[13,(i)]:= sd.s1[(i-1)].p_AccessionNo;
tdvsform(Fparent).AdvStringGrid1.cells[14,(i)]:= sd.s1[(i-1)].p_StudyUid;
end;
end
else
showmessage('No Record Found');
for i:=1 to (sd.Length_Record) do
tdvsform(Fparent).AdvStringGrid1.AddNode(i,1);
finally
sd.free;
end;