Einzelnen Beitrag anzeigen

omata

Registriert seit: 26. Aug 2004
Ort: Nebel auf Amrum
3.154 Beiträge
 
Delphi 7 Enterprise
 
#2

Re: AccessViolation bei CallBack

  Alt 27. Aug 2008, 22:39
Las mal den Zeiger weg, dann klappt das auch.

Delphi-Quellcode:
type
  TDownloadCallBackStatus = procedure(FilesDownloaded: Integer) of object;

  Txxx = class(T...)
  private
    {...}
    FDownloadCallBackStatus:TDownloadCallBackStatus;
  public
    {...}
    property OnDownloadCallBackStatus:TDownloadCallBackStatus
      read FDownloadCallBackStatus write FDownloadCallBackStatus;
    procedure DownloadOrSynchronize(SearchString: string; OnlySync: boolean);
  end;

procedure Txxx.DownloadOrSynchronize(SearchString: string; OnlySync: boolean);
var
begin
  {...}

  if Assigned(FDownloadCallBackStatus) then
    FDownloadCallBackStatus(j);

  {...}
end;

procedure CallBack(FilesDownloaded: Integer);
begin
  MainForm.label_x.Caption := inttostr(FilesDownloaded);
end;

procedure TMainForm.btn_download_click(Sender: TObject);
begin
  {...}
  AOBJ.OnDownloadCallBackStatus:=CallBack;
  AOBJ.DownloadOrSynchronize(edt_tags.Text, chk_nodownload.Checked);
  {...}
end;
  Mit Zitat antworten Zitat