Hi Again.

Im trying to write an autosave function for a stringgrid ising threads (so it can 
happen in the background)

I have the following code to test it....

the first TAutosave.execute procedure just hangs the application, but the second one 
(commented out) works fine.

Is this because Im trying to access components on the calling form?

Any thoughts?

Chris


*******************************

procedure TForm2.ToolButton14Click(Sender: TObject);
var
  mythread:TAutosave;
begin
  mythread := TAutosave.Create(false);
end;

******************************
and in the thread itself

procedure TAutosave.Execute;
begin
  if exportfilename <> '' then
  begin
    //just re-save to the existing filename chosen by the user
    try
      {export from string grid}
      form2.SMExportToXLS1.ColumnSource := csDataEngine;
      form2.SMExportToXLS1.FileName := exportfilename;

      form2.SMExportToXLS1.Execute;

      //let them know the save was successful
      saved := true;
      synchronize(showresult);
    except on e:exception do
    end;
  end;
end;


{procedure TAutosave.Execute;
var
  i:integer;
begin
  for i := 1 to 2000000 do
  begin
    inc(answer, round(abs(sin(sqrt(i)))));
    synchronize(showresult);
  end;
end;
}
procedure TAutosave.Showresult;
begin
  form2.RzMarqueeStatus1.Caption := 'Autosave Complete';
end;

**********************************


______________________________________________________

The contents of this e-mail are privileged and/or confidential to the
named recipient and are not to be used by any other person and/or
organisation. If you have received this e-mail in error, please notify 
the sender and delete all material pertaining to this e-mail.
______________________________________________________
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to