Paul,
I try to expain what is happening. You pass in handler "mouseUp"
Routine_B "DEF",aData_A,tData_B
aData_A unreferenced to Routine_B, from there it goes referenced through some permutations and comes back unreferenced to handler "mouseUp".
This means your initial value is unchanged.
A command does not return anything except for the result which you have to set and read explicitly.
The unreferenced aData_A coming back is the same as when it was sent off to Routine_B.
To show this effect you could turn Routine_B into a function and return
Like this
Code: Select all
function Routine_B InData, aData_A, @tData_B // This routine needs the data from aData_A
put InData & "XYZ" into tData_B
Routine_C "GHI",aData_A,tData_C // Routine_B needs Routine_C
# check if data is added to aData_A
put aData_A[0] into tData_B00 // Original data is stil there.
put aData_A[-1] into tData_B01 // Data is added is available.
breakpoint
return aData_A
end Routine_B
and call it in mouseUp
Code: Select all
put Routine_B ("DEF",aData_A,tData_B) into aData_A
That works
However you could use the referencing trick and simply add "@" to aData_A like this
Code: Select all
command Routine_B InData, @aData_A, @tData_B
Then it keeps aData_A open for changes and you do not have to return it explicitly. (by the way in your current use "@tData_B" does not have to be referenced)
for completeness here is you revised code and just one "@" added.
Code: Select all
local aData_A
on mouseup
Routine_A 0,aData_A
--
Routine_B "DEF",aData_A,tData_B
# check if data is added to aData_A
put aData_A[0] into tData_0 // Original data is stil there.
put aData_A[-1] into tData_1 // Data is gone ?!
breakpoint
End mouseup
---
command Routine_A InNbr @aData_A
put "ABC_"&InNbr into aData_A[InNbr] // Fill array with original data.
end Routine_A
---
command Routine_B InData, @aData_A @tData_B // This routine needs the data from aData_A
put InData & "XYZ" into tData_B
Routine_C "GHI",aData_A,tData_C // Routine_B needs Routine_C
# check if data is added to aData_A
put aData_A[0] into tData_B00 // Original data is stil there.
put aData_A[-1] into tData_B01 // Data is added is available.
breakpoint
end Routine_B
---
command Routine_C Input @aData_A, @tData_C
put -1 into tNbr
Routine_A tNbr,aData_A // Call Routine_A with number is -1 so additional data is added to aData_A
put Input into tData_C
# check if data is added to aData_A
put aData_A[0] into tData_C00 // Original data is stil there.
put aData_A[-1] into tData_C01 // Data is added is available.
breakpoint
end Routine_C
That it the reason why your modified code does not work.
Or at least how I understand the flow of events. I hope my attempted explanation makes some sense.
Kind regards
Bernd