Page 1 of 1

:refreshall() not updating browse

Posted: Fri Jul 29, 2016 3:19 pm
by Tim K
I'm pretty new to the Xpress browsing windows so I might be missing something obvious. I'm building a restore function so that a user can continue from a saved state. I save the data array to a file and then update the main data array to the saved array. The data array gets updated fine but the browse won't update after a :refreshall() and forcestable(). The array is private. I can see in the DC_xbpBrowse object that the :datasource is still not updated.

Re: :refreshall() not updating browse

Posted: Fri Jul 29, 2016 10:50 pm
by Wolfgang Ciriack
You don't need to make the array private, make it local and set a new array for the DCBROWSE with dc_getbrowarray(oBrowse, aNew). For saving and restoring the array to a file use the functions DC_ARRAY_W(aAct,myfile) and aNew:=DC_ARRAY_R(myfile).

Re: :refreshall() not updating browse

Posted: Sat Jul 30, 2016 6:30 am
by rdonnay
When you restore an array using DC_Array_R() or DC_ARestore(), you are creating a new pointer to the array in memory.

To attached the new array pointer to the browse do the following:

Code: Select all

aNewArray := DC_ARestore('MyNewArray.Ar')
oBrowse:dataSource := aNewArray
oBrowse:refreshAll()

Re: :refreshall() not updating browse

Posted: Sat Jul 30, 2016 3:47 pm
by Cliff Wiernik
Roger,

Are you saying we should be updating of the browse:dataSource instead of DC_Getbrowarray() or is there no difference using one method versus the other.

Cliff

Re: :refreshall() not updating browse

Posted: Sat Jul 30, 2016 3:56 pm
by rdonnay
They both do the same thing.

Re: :refreshall() not updating browse

Posted: Mon Aug 01, 2016 7:31 am
by Tim K
That did it, thanks, guys!

Re: :refreshall() not updating browse

Posted: Fri Aug 12, 2016 5:35 am
by digitsoft
Hi Roger
Doing it this oBrowse Best Form :refreshAll (aNewArray) and that: refreshall you do this oBrowse: DataSource: = aNewArray) if you send the parameter, this modification the tube to do, but I would like to be Native Expresss

Because the same problem is if we use Object SQL

Thank you

Re: :refreshall() not updating browse

Posted: Fri Aug 12, 2016 7:30 am
by rdonnay
Nolberto -

That sounds like a good idea and an easy implementation.
I just added it to _DCXBROW.PRG.

Line 1340

Code: Select all

WAS:
METHOD DC_XbpBrowse:RefreshAll()

IS:
METHOD DC_XbpBrowse:RefreshAll( aNewArray )
Line 1368

Code: Select all

WAS:
elseif ::dataSourceType = BROWSE_ARRAY   

IS:
elseif ::dataSourceType = BROWSE_ARRAY     
   IF Valtype(aNewArray) == 'A'
     ::dataSource := aNewArray
   ENDIF