Page 1 of 1

Change oBrw:aSelected outsite xbrowse

Posted: Fri Mar 19, 2021 3:58 pm
by Marc Venken
Can we change the status of aSelected?

The idea is that I call several functions (one by one) with a different ordscope() selection. The result records of that selection should be set to .t. in de aSelected
Next again a ordscope with other results, but these also need to be set .t. in aselected.
etc...

Finaly all selections are made and oBrw:aSelected contains all record from different searches/selections.

redraw of xbrowse should show all the records in aSelected.

Re: Change oBrw:aSelected outsite xbrowse

Posted: Fri Mar 19, 2021 7:07 pm
by nageswaragunupudi
Purpose of oBrw:aSelected is totally different.
What you want is you prepare an array of record numbers, which you want to show in xbrowse.

In this sample, aRecs represent the array aSelected you are referring to:

Code: Select all | Expand

#include "fivewin.ch"

function Main()

   local oDlg, oFont, oBrw
   local aRecs    := { 3, 10, 20 }

   USE STATES
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 400,300 PIXEL TRUEPIXEL FONT oFont ;
      TITLE "FILTER BY ARRAY"

   @ 80,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "STATES" ;
      COLUMNS "RECNO()", "CODE", "NAME" ;
      HEADERS "REC" PICTURES "999" ;
      CELL LINES NOBORDER ;
      ROWS aRecs

   oBrw:CreateFromCode()

   @ 20,20 BUTTON "CHANGE RECORDS" SIZE 200,40 PIXEL OF oDlg ;
      ACTION ( oBrw:aArrayData := { 3, 10, 20, 7, 23, 47 }, oBrw:Refresh() )

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil
 


Image

Re: Change oBrw:aSelected outsite xbrowse

Posted: Sat Mar 20, 2021 10:02 am
by Marc Venken
Thanks for sending me in the correct direction !!

In every lookup function (afther selection)
I will add records to the array with a dbeval(....aadd()..)