Page 1 of 2
AutoRefresh when
Posted: Thu Aug 30, 2012 5:31 am
by bwolfsohn
Roger,
using the latest release, the when clause of autorefresh seems to turn off autorefresh completely.
This browse works w/ autorefresh and no when clause. After added when clause (which always returns .t.), auto refresh stops working.
What am i screwing up now, oh wise one ??
@ .7,1 DCBROWSE olotBrowse ;
ALIAS 'LOT' ;
SIZE (nStaticWidth-4),(nBottom-.5) ;
PRESENTATION DC_BrowPres() ;
PARENT olotStatic ;
ID "OLOTBROWSE" ;
FONT cSayFont ;
HEADLINES 1 ;
AUTOREFRESH m->nBrowseRefresh WHEN {||myautorefresh()} ;
RBSELECT ;
RBDOWN BrowseMenuBlock(@oLotBrowse) ;
COLOR bColor ;
RESIZE DCGUI_RESIZE_RESIZEONLY ;
ITEMSELECTED {||EditCell(oLotBrowse) }
Re: AutoRefresh when
Posted: Thu Aug 30, 2012 10:14 am
by rdonnay
The below code (from _dcxbrow.prg) has not changed since build 255.
I suggest adding a WTF to your Refresh When block to see if it is getting evaluated.
Code: Select all
METHOD DC_XbpBrowse:handleEvent( nEvent, mp1, mp2 )
IF nEvent == DCGUI_EVENT_BROWSE_REFRESH
IF ::isVisible()
IF Empty(::refreshWhenBlock) .OR. Eval(::refreshWhenBlock)
IF Valtype(::refreshBlock) == 'B'
Eval(::refreshBlock,self)
ELSE
::Refresh()
ENDIF
ENDIF
ENDIF
ELSE
RETURN ::XbpbrowseHandleEvent( nEvent, mp1, mp2 )
ENDIF
RETURN self
* --------------------
METHOD DC_XbpBrowse:setTimerRefresh()
DEFAULT ::refreshInterval := 0
IF ::refreshInterval > 0
::timer := DC_SetTimerEvent():new(::refreshInterval, ;
{||PostAppEvent(DCGUI_EVENT_BROWSE_REFRESH,,,self)})
ENDIF
RETURN self
Re: AutoRefresh when
Posted: Thu Aug 30, 2012 10:28 am
by bwolfsohn
[quote="rdonnay"]The below code (from _dcxbrow.prg) has not changed since build 255.
I suggest adding a WTF to your Refresh When block to see if it is getting evaluated.
Roger,
I did.. it is... when i click the button to turn autorefresh, wtf returns .f.. when it's .t., the browse is not refreshing..
slightly different browse config w/o the when clause refreshes properly..
**********************
function myautorefresh(aGetlist)
**********************
static slIsRefreshOn
IF slIsRefreshOn==nil
slIsRefreshOn:=.t.
ENDIF
IF !slIsRefreshon
wtf slIsRefreshon
ENDIF
IF !aGetlist==nil
slIsRefreshon:=!slIsRefreshOn
DC_GetObject(aGetList,'REFRESHBUTTON'):setcaption('Autorefresh '+IIF( slIsRefreshOn,"Off" ,"On" ))
ENDIF
return(slIsRefreshOn)
Re: AutoRefresh when
Posted: Thu Aug 30, 2012 11:10 am
by rdonnay
Are you saying this used to work?
Now that I look at your code, I think I see the problem.
You should never toggle the value inside the WHEN code block because it will toggle every other time it's called.
This code looks confusing to me.
Re: AutoRefresh when
Posted: Thu Aug 30, 2012 11:13 am
by bwolfsohn
rdonnay wrote:Are you saying this used to work?
No.
I just implemented autorefresh.. it worked w/ no problem, except that some users didn't like it refreshing..
so i added a button to turn on/off autorefresh.
in order to do that, i had to use the autorefresh when clause for the first time.
that's when it stopped autorefreshing.
Re: AutoRefresh when
Posted: Thu Aug 30, 2012 11:26 am
by rdonnay
But the toggle should be on the action of the button, not in the WHEN block.
Re: AutoRefresh when
Posted: Thu Aug 30, 2012 11:45 am
by bwolfsohn
Roger,
i changed
AUTOREFRESH m->nBrowseRefresh WHEN {||myautorefresh()} ;
to
AUTOREFRESH m->nBrowseRefresh WHEN {||.t.} ;
and the autorefresh does NOT work..
when i take out the when clause it works..
Re: AutoRefresh when
Posted: Thu Aug 30, 2012 12:25 pm
by rdonnay
What version of eXpress++ are you using?
I don't see anything wrong with this code.
Re: AutoRefresh when
Posted: Thu Aug 30, 2012 1:00 pm
by bwolfsohn
257+
dclipx dated 8/15
dcdialog dated 7/31
Re: AutoRefresh when
Posted: Thu Aug 30, 2012 1:28 pm
by gnewcomb
Roger,
Are the WHEN and REFRESHBLOCK options being reversed in your GETLIST_OPTIONS array ?