get and codeblock
Posted: Thu Sep 22, 2016 8:09 am
Hello Roger
we just have a discussion in the german newsgroup, in this sample the value in the get is only changed when not using asize(0) and the add the values new to the array. Do you have an answer for this behaviour ? Not urgent, but would be interesting, I think it has to do with the reference to the array in the getlist.
regards
Rudolf
we just have a discussion in the german newsgroup, in this sample the value in the get is only changed when not using asize(0) and the add the values new to the array. Do you have an answer for this behaviour ? Not urgent, but would be interesting, I think it has to do with the reference to the array in the getlist.
regards
Rudolf
Code: Select all
procedure xtest()
LOCAL GetList:={}, arr:={}
aadd(arr,{"Karl ","Meier "})
@ 02,01 dcsay {||arr[1,1]} saysize 0
@ 02,10 dcget arr[1,1] // <----- does not change the value with fhein() und fewald()
@ 03,01 dcsay {||arr[1,2]} saysize 0
@ 03,10 dcget arr[1,2] // <----- does not change the value with fhein() und fewald()
@ 05,01 dcbrowse ob1 data arr size 50,4 fit
dcbrowsecol element 1 header "Vorname" parent ob1 width 10
dcbrowsecol element 2 header "Name" parent ob1 width 10
@ 12,0 dcpushbutton caption "Hein" size 10,1 ;
action {||fhein(arr,getlist)}
@ 12,10 dcpushbutton caption "Ewald" size 10,1 ;
action {||fewald(arr,getlist)}
@ 12,20 dcpushbutton caption "Hein 2" size 10,1 ;
action {||fhein2(arr,getlist)}
@ 12,30 dcpushbutton caption "Ewald 2" size 10,1 ;
action {||fewald2(arr,getlist)}
DCREAD GUI FIT
RETURN
function fhein(arr,aGetlist)
asize(arr,0)
aadd(arr,{"Hein","Mück"}) // not visible in get codeblock
dc_getrefresh(aGetlist)
return .t.
function fewald(arr,aGetlist)
asize(arr,0)
aadd(arr,{"Ewald ","Saur"}) // not visible in get codeblock
dc_getrefresh(aGetlist)
return .t.
function fhein2(arr,aGetlist)
arr[1,1] := "Hein" // this way it works works
arr[1,2] := "Mück"
dc_getrefresh(aGetlist)
return .t.
function fewald2(arr,aGetlist)
arr[1,1] := "Müller" // works
arr[1,2] := "Franz" // works
dc_getrefresh(aGetlist)
return .t.