We have some generated XTREE cell validation/onchange function calls to code in our custom written .bsi modules. They pass the array element as a parameter that can be updated by the callee function with xputarg
.gen generated code is calling like this
PRIVATE DIMX dlg'enter'backstock_xtr'backstock_ans(1),x,223,AUTO_EXTEND ! answer array
rc = fn'dlg'enter'backstock_xtr'backstock_col_description_onChanged(ansrec=dlg'enter'backstock_xtr'backstock_ans(cell.row), row=cell.row, exitcode=exitcode)
.bsi - custom written validation logic (not exact but close enough to represent the issue)
FUNCTION fn'dlg'enter'backstock_xtr'backstock_col_description_onChanged(ansrec as DLG'ENTER'BACKSTOCK_XTR'BACKSTOCK_ANSARY'STRUCT, row as f8, exitcode as f8) as f8
IF (not'valid)
.fn = NotValid
Set focus on the cell
ELSE
if valid
populate ansrec read only columns data (.i.e item stock number, quantity info etc)
add a blank row the xtree
ENDIF
$exit:
XPUTARG @ansrec
ENDFUNCTION
The issue we have seen is with one row in the XTREE array, when validation passes and we add a row to the array before the xputarg occurs, the first row of data is blank. This is not XTREE issue, but what we think is happening, the AUTO_EXTEND array is being moved in memory and caller code is still pointing to the original memory location. Thus, the first row of data is lost to wherever in memory the previous location of the array was.
Hopefully, this is clear enough. Is this a valid issue?