Page 1 of 1

A problem with xBrowse and arrays

PostPosted: Wed May 02, 2018 1:52 pm
by Enrico Maria Giordano
Can you tell me why this sample selects the workarea 0 after closing the window?

Code: Select all  Expand view
#include "fivewin.ch"


FUNCTION MAIN()

    LOCAL oWnd, oBrw, oCol

    LOCAL aCell := { {} , {} ,{} ,{} ,{} ,{} ,{} }

    SELECT 0

    USE CUSTOMER

    AADD( aCell[ 1 ] , "One"   )
    AADD( aCell[ 1 ] , "Two"   )
    AADD( aCell[ 1 ] , "Three" )

    DEFINE WINDOW oWnd

    @ 100, 100 XBROWSE oBrw OF oWnd DATASOURCE aCell CELL LINES

    oCol = oBrw:AddCol()
    oCol:bEditValue   = { || aCell[ 1 , oBrw:nArrayAt  ] }

    oBrw:CreateFromCode()

    oWnd:oClient = oBrw

    ? "Before:", ALIAS(), SELECT()

    ACTIVATE WINDOW oWnd

    ? "After:", ALIAS(), SELECT()

    RETURN NIL


EMG

Re: A problem with xBrowse and arrays

PostPosted: Thu May 03, 2018 3:20 am
by nageswaragunupudi
Thanks for pointing this out. This happens only when Evaluation of bEditValue results in an error. (In the present case when oBrw:nArrayAt > 3 ).
This does not happen where the bEditValue is valid for the entire browse.
This is fixed in 18.04.