DCBROWSE autorefresh

This forum is for eXpress++ general support.
Message
Author
Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

DCBROWSE autorefresh

#1 Post by Wolfgang Ciriack »

Hi all,
i have a scoped DCBROWSE with autorefresh and a display of the amount of reccords (dc_keycount()) in the scope. Now i like to update the display of the amount of records, if the autorefresh take place (every 5 seconds). How can this be done, can someone give me a hint ?
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBROWSE autorefresh

#2 Post by rdonnay »

Use the REFRESHBLOCK subclause of AUTOREFRESH.

[AUTOREFRESH <nRefreshInterval> [REFRESHBLOCK <bRefresh>]

In bRefresh block you would put your code to update the display.
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DCBROWSE autorefresh

#3 Post by Wolfgang Ciriack »

Thanks Roger,
but when using this, i always get an error in the line 896:

Code: Select all

IF Empty(::refreshWhenBlock) .OR. Eval(::refreshWhenBlock)

Code: Select all

oError:args         :
          -> VALTYPE: L VALUE: N
          -> VALTYPE: U VALUE: NIL
oError:canDefault   : N
oError:canRetry     : N
oError:canSubstitute: J
oError:cargo        : NIL
oError:description  : Parameter hat falschen Typ
oError:filename     : 
oError:genCode      :          2
oError:operation    : <.F.>.or.<NIL>
oError:osCode       :          0
oError:severity     :          2
oError:subCode      :          3
oError:subSystem    : BASE
oError:thread       :          1
oError:tries        :          0



------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Aufgerufen von DC_XBPBROWSE:HANDLEEVENT(896)
_______________________
Best Regards
Wolfgang

reganc
Posts: 259
Joined: Thu Jan 28, 2010 3:08 am
Location: Hersham, Surrey, UK
Contact:

Re: DCBROWSE autorefresh

#4 Post by reganc »

Wolfgang Ciriack wrote:Thanks Roger,
but when using this, i always get an error in the line 896:

Code: Select all

IF Empty(::refreshWhenBlock) .OR. Eval(::refreshWhenBlock)

Code: Select all

oError:args         :
          -> VALTYPE: L VALUE: N
          -> VALTYPE: U VALUE: NIL
oError:canDefault   : N
oError:canRetry     : N
oError:canSubstitute: J
oError:cargo        : NIL
oError:description  : Parameter hat falschen Typ
oError:filename     : 
oError:genCode      :          2
oError:operation    : <.F.>.or.<NIL>
oError:osCode       :          0
oError:severity     :          2
oError:subCode      :          3
oError:subSystem    : BASE
oError:thread       :          1
oError:tries        :          0

------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Aufgerufen von DC_XBPBROWSE:HANDLEEVENT(896)
The docs say:

AUTOREFRESH <nTimer> is used to set a timer event that automatically
refreshes the browse window (when it is visible) every
<nTimer>/100 seconds. REFRESHBLOCK <bRefresh> is an optional
code block to evaluate rather than using the default :refresh()
method. WHEN <bRefreshWhen> is an option codeblock to evaluate
to cause the refresh to occur only when the codeblock returns a
.TRUE. value.

It looks like the when codeblock is not returning a TRUE or FALSE value. Are you using the AUTOREFRESH...WHEN clause? If not try giving it a codeblock that always returns TRUE.
Regan Cawkwell
Real Business Applications Ltd
http://www.rbauk.com

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBROWSE autorefresh

#5 Post by rdonnay »

Try this:

Code: Select all

.. REFRESHBLOCK {||myRefreshFunction()} WHEN {||.t.}
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DCBROWSE autorefresh

#6 Post by Wolfgang Ciriack »

Hi Roger,
i have tried it with bWhenBlock and without, every time the same error. Here is my code:

Code: Select all

     @2.4,0.5 DCBROWSE oMainBrowse ;
       DATA cAlias ;
       SIZE min(br-20,iif(pInstMobile,116,114)), ho-5 ;
       CURSORMODE XBPBRW_CURSOR_ROW ;
       PRESENTATION aPresPar1 ;
       ITEMSELECTED {|| iif(userrights>=RIGHTS_E, StartAufBearb(), NIL), oMainBrowse:refreshAll(), SetAppFocus(oMainBrowse) } ;
       ITEMMARKED {|| bau->(dbseek(str(auf->baustelle,7),,1)), dc_getrefresh(GetList,,DCGETREFRESH_ID_INCLUDE,aRefId), oKfzBrowse:RefreshAll() } ;
       ID "IDBRW" ;
       FREEZELEFT iif(pInstMobile,{1,2,3,4,5,6,7},{1,2,3,4,5,6}) ;
       TABSTOP ;
       EVAL {|o| o:ItemRbDown:={|aMPos,aLC,oBr| dc_getrefresh(oPopupMenu), ActRbMenu(aMPos,aLC,oBr,oPopupMenu)} } ;
       AUTOREFRESH refrwert  REFRESHBLOCK {|| dc_getrefresh(oAnzRec) } WHEN {|| .T. }

*       AUTOREFRESH refrwert WHEN {|| .T.SetAppFocus()=oMainBrowse } REFRESHBLOCK {|| dc_getrefresh(oAnzRec) }
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBROWSE autorefresh

#7 Post by rdonnay »

This this:

Code: Select all

REFRESHBLOCK {|| dc_getrefresh(oAnzRec), .t. }
The eXpress train is coming - and it has more cars.

Wolfgang Ciriack
Posts: 484
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DCBROWSE autorefresh

#8 Post by Wolfgang Ciriack »

Hi Roger,
i read the docs and thougt, only the WHEN codeblock must return a logical value. Thanks for the clarification.
_______________________
Best Regards
Wolfgang

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DCBROWSE autorefresh

#9 Post by rdonnay »

I will have to correct that in the docs.
The eXpress train is coming - and it has more cars.

gnewcomb
Posts: 17
Joined: Thu Jan 28, 2010 7:06 pm
Location: Colorado Springs, Colorado USA

Re: DCBROWSE autorefresh

#10 Post by gnewcomb »

Unless I am mistaken, shouldn't lines 336 and 337 in _dcxbrow.prg

Code: Select all

::refreshWhenBlock := aArray[47]
::refreshBlock := aArray[48]
be changed to

Code: Select all

::refreshWhenBlock := aArray[48]
::refreshBlock := aArray[47]

Post Reply