Automatic xbrowse refresh

Automatic xbrowse refresh

Postby Adolfo » Sat Oct 20, 2018 3:50 pm

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
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Automatic xbrowse refresh

Postby Jack » Sat Oct 20, 2018 3:57 pm

Hi ,

You can look at TIMER

DEFINE TIMER oTmr INTERVAL 6000 ACTION (oLbx:Refresh()) OF oWnd
ACTIVATE TIMER oTmr
Jack
 
Posts: 288
Joined: Wed Jul 11, 2007 11:06 am

Re: Automatic xbrowse refresh

Postby Jack » Sat Oct 20, 2018 4:02 pm

You have also setidleactin({||UDF()})

TestIdle.prg
Jack
 
Posts: 288
Joined: Wed Jul 11, 2007 11:06 am

Re: Automatic xbrowse refresh

Postby armando.lagunas » Sat Oct 20, 2018 4:27 pm

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  Expand view  RUN

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
SkyPe: armando.lagunas@hotmail.com
Mail: armando.lagunas@gmail.com
User avatar
armando.lagunas
 
Posts: 346
Joined: Mon Oct 05, 2009 3:35 pm
Location: Curico-Chile

Re: Automatic xbrowse refresh

Postby Adolfo » Mon Oct 22, 2018 12:39 pm

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
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Automatic xbrowse refresh

Postby Jack » Mon Oct 22, 2018 1:55 pm

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
Jack
 
Posts: 288
Joined: Wed Jul 11, 2007 11:06 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 73 guests