ExecuteOnEvent (TitTask)
function ExecuteOnEvent(const iEventID:string; var aReason:string):boolean;
Cette fonction exécute la tâche sur un évènement.
La tâche sera exécutée une fois.
| Paramètre | Usage |
|---|---|
| iEventID | Identifiant de l'évènement déclenchant l'exécution de la tâche |
| aReason | Informations sur l'erreur |
| Result | True si la tâche a été posté |
Exemple :
//Procedure CreateActivity;
var inst:TdbfActivity; instN:OnActivityEvent; aReason:string;
begin
// Create a user activity
//
withP Transaction do
begin
inst := TdbfActivity.Create;
inst.Caption := 'Activité with event';
inst.AddParameter('param1','Value1');
inst.AddParameter('param2',2);
inst.AttachUser(glbUserName,True);
end;
// Create a task executed when the activity is finished.
//
instN := OnActivityEvent.Create;
instN.ActivityRef := inst;
if not instN.ExecuteOnEvent(inst.OnTerminateID,aReason) then
begin
ShowMessage('Post onTerminate task failed:'+aReason);
end;
end;
Voir aussi: