AutoRefresh when

This forum is for eXpress++ general support.
Message
Author
bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

AutoRefresh when

#1 Post 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) }
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

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

Re: AutoRefresh when

#2 Post 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

The eXpress train is coming - and it has more cars.

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: AutoRefresh when

#3 Post 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.. :cry:

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)
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

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

Re: AutoRefresh when

#4 Post 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.
The eXpress train is coming - and it has more cars.

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: AutoRefresh when

#5 Post 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.
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

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

Re: AutoRefresh when

#6 Post by rdonnay »

But the toggle should be on the action of the button, not in the WHEN block.
The eXpress train is coming - and it has more cars.

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: AutoRefresh when

#7 Post 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..
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

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

Re: AutoRefresh when

#8 Post by rdonnay »

What version of eXpress++ are you using?

I don't see anything wrong with this code.
The eXpress train is coming - and it has more cars.

bwolfsohn
Posts: 649
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: AutoRefresh when

#9 Post by bwolfsohn »

257+

dclipx dated 8/15

dcdialog dated 7/31
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

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

Re: AutoRefresh when

#10 Post by gnewcomb »

Roger,

Are the WHEN and REFRESHBLOCK options being reversed in your GETLIST_OPTIONS array ?

Post Reply