views:

266

answers:

1

Hello

I am using turbopower's stExport from the systools' package. Using it to export a dataset. That works great. The Class makes available FOnExportProgress. This class does not have a visual component and so no object inspector to simply double click and have delphi create the event for me. Can anyone provide a simple example of how to create the event manually??

For most visual components delphi provides this for you. Example:

procedure TForm1.Button1Click(Sender: TObject);
begin
 //code here
end;

How does one manually create this.

I include a bit of the class below that refers to the event.

type
  TStExportProgressEvent = procedure (Sender : TObject; Index : Integer;
    var Abort : Boolean) of object;

FOnExportProgress : TStExportProgressEvent;
    FOnQuoteField : TStOnQuoteFieldEvent;

if Assigned(FOnExportProgress) then
        FOnExportProgress(self, Count, Abort);

How do I manually assign the OnExportProgress.

Please include a simple example !

Thank you.

A: 

Assuming this is all happening inside your form

type
  TForm1 = class(TForm)
  published
    procedure FormCreate(Sender: TObject);
  private
    FMyExport : TStDBtoCSVExport;
    procedure TForm1.MyExportProgressHandler(Sender : TObject; Index : Integer;
                                             var Abort : Boolean);        
  end;

procedure TForm1.Create(inOwner);
begin
  FMyExport := TStDBtoCSVExport.Create;
  FMyExport.OnExportProgress := MyExportProgressHandler;
end;

procedure TForm1.MyExportProgressHandler(Sender : TObject; Index : Integer;
                                         var Abort : Boolean);
begin
  { anything you like }
end;
LachlanG
Hi and thanks. Not working in existing project. Tried new project. The part TForm1.MyExportProgressHandler(...) delphi complains about undeclared identifier. Perhaps an example with the units full layout would get me over this hump. Thanks again
I don't have a full unit sorry that was off the top of my head. Which identifier is it having a problem with specifically?
LachlanG
Procedure TForm1.MyExportProgressHandler(...). Also no sure about InOwner. could you elaborate ?. Don't mean a whole unit but rather just where the implementation part goes and perhaps add a button and this should help me figure out where to place statements. Thanks again. If I can provide anything?
Try declaring as MyExportProgressHandler(Sender : TObject; Index : Integer; var Abort : Boolean); Do not include the TForm1.
yozey