Page 1 of 1

Automatic xbrowse refresh

Posted: Sat Oct 20, 2018 3:50 pm
by Adolfo
Hi fivewinners.

Any idea on how to automatically refresh a xbrowse after a few minutes of inactivity (no key stroke)

Any help will be appreciated

Thanks in advance

From Chile
Adolfo

Re: Automatic xbrowse refresh

Posted: Sat Oct 20, 2018 3:57 pm
by Jack
Hi ,

You can look at TIMER

DEFINE TIMER oTmr INTERVAL 6000 ACTION (oLbx:Refresh()) OF oWnd
ACTIVATE TIMER oTmr

Re: Automatic xbrowse refresh

Posted: Sat Oct 20, 2018 4:02 pm
by Jack
You have also setidleactin({||UDF()})

TestIdle.prg

Re: Automatic xbrowse refresh

Posted: Sat Oct 20, 2018 4:27 pm
by armando.lagunas
Adolfo:
yo lo hago en una window..
se actualiza cada 30 seg aprox.

la funcion Recargar_Datos( oBrw ), es donde realizo el proceso de carga del xbrowse...

Code: Select all

static nCargo := 0

...
....
....
   ACTIVATE WINDOW xWnd NORMAL ON INIT  ( xWnd:Center(),  GoTimer( xWnd, oBrw ) ) 

RETURN Nil

//-------------------------------------------------------------------------

STATIC FUNCTION GoTimer( xWnd, oBrw )
LOCAL oTmr
     DEFINE   TIMER oTmr OF xWnd INTERVAL 1 ACTION IIF( nCargo > 799, ( Recargar_Datos(  oBrw ), nCargo := 0 ), nCargo += 1 )
     ACTIVATE TIMER oTmr
RETURN Nil

//-------------------------------------------------------------------------

 
espero de que te sirva.

Saludos

Re: Automatic xbrowse refresh

Posted: Mon Oct 22, 2018 12:39 pm
by Adolfo
Thanks to all ...

Jack
SetIdleAction() is only for 16 bits and can cause app freeze.

Armando.
I need to control the time after the last keystroke is done, not at a defined period of time
SP: Necesito controlar el tiempo despues de la ultima tecla presionada, no a un periodo de tiempo definido.

If the user is working in the xBrowse, I let him do his job because I have a routine to do it after he modiies or sees any data, but if he leaves his workplace, I'm want to refresh it after some minutes, so if he returns, he can see new or modified data.

That's the idea.

From Chile
Adolfo

Re: Automatic xbrowse refresh

Posted: Mon Oct 22, 2018 1:55 pm
by Jack
Hi,
When i start the xbrowe, i get the time() in a static / global var

When i use the on change, ik get the time in a the same static / global var

In the timer i compre the actual time with the static/gloval var and if it is too long, i do a frefresh() .

Philippe