Página 1 de 1

How to fire a routine at an interval time

Publicado: Lun Jul 22, 2024 3:18 pm
por Milan Mehta
I need to fire a function at an interval of time (say 5 seconds) till a condition is met.

For example, when the user Presses a button called "Payment", I need to check the status of the payment every 5 seconds till I get the reply "Success" or maximum 10 times whichever is first.

How can I ?

TIA

Milan Mehta.

Re: How to fire a routine at an interval time

Publicado: Lun Jul 22, 2024 4:31 pm
por ignacio
Hi,

Use a timer. Five seconds its a nInterval of 5000. For example:

Código: Seleccionar todo

oTimer := TTimer():Create( oForm, 5000, {|| CheckPayment() } )
Inside the CheckPayment function you can easily control the iterations. Important: DO NOT FORGET TO DESTROY DE TIMER.

Regards,