Eric Tishler wrote:

I am trying to use TAHMScheduler (from Triton Tools), but I am having problems 
defining the tasks to be scheduled.

I use the following ...

scheduler.Schedules.Add.TriggerTime := '17:30';
scheduler.Schedules.Add.MethodName(Test_A of AppMainForm));

where Test_A is a valid Procedure in AppMainForm that I would like invoked at 17:30

I have also tried the following syntax ...

scheduler.Schedules.Add.TriggerTime := '17:30';
scheduler.Schedules.Add.MethodName(Test_A));

both yield the same compiler error:

[Error] uMain.pas(5489): Incompatible types: 'procedure, untyped pointer or untyped 
parameter' and 'Pointer'



In the absence of any other (better) answers, it looks like your parameter to MethodName needs to be a pointer. Check the delphi help for passing procedures, but I think you need to do one of

var
  p : Pointer;
...
  p^ := Test_A

or

  scheduler.Schedules.Add.MethodName(@Test_A));

But I only ever remember my pointer arithmetic by going
back to first principles and drawing lots of pictures , and you're
probably better off doing:

var
  p : TProcedure;
...
  p := Test_A;  //Assumes Test_A has no parameters.

And note that a procedure is different from a method.

Additionally, if your scheduler follows /standard/ (for
whatever meaning of standard) syntax, you'd sort of expect to do:

s : TSchecule; //or whatever
...

  s := scheduler.Schedules.Add;
  s.TriggerTime := '17:30';
  s.MethodName(Test_A);

Which makes the MethodName(Test_A) look real ugly, and I want to :
  s.MethodName := Test_A
  or
  s.setMethodName(Test_A)

Cheers, Kurt.
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to