Macro get problem
Posted: Thu Jan 28, 2021 1:50 pm
Hi Roger!
I found a problem when using GET for a database field with a macro.
This is sample program:
In exp 267 it is impossible to change the data in gets, but in exp 265 works well.
I found the source of the problem in _dcgetbx.prg
In FUNCTION DC_GetAnchorCB(....
If I remove the 3 (<<<<<) lines from the code, the problem disappears.
It restore this part of the code to the exp 266 version.
I think it is not the best solution, because there was a reason why You changed it, and it can cause other problems I am not aware now.
Best regards,
Zoltan
I found a problem when using GET for a database field with a macro.
This is sample program:
Code: Select all
#INCLUDE "dcdialog.ch"
#pragma Library("dclipx.lib")
PROC appsys
RETURN
PROCEDURE DBESYS
DbeLoad("FOXDBE")
DbeLoad("CDXDBE")
DbeBuild("FOXCDX","FOXDBE","CDXDBE")
RETURN
PROCEDURE main
LOCAL i, GetList[0], GetOptions,instdbf:={}
aadd(instdbf,{"field1","C",30,0})
aadd(instdbf,{"field2","C",30,0})
aadd(instdbf,{"field3","C",30,0})
dbcreate("testdbf.dbf",instdbf)
use testdbf new exclusive
if lastrec()=0
append blank
endif
wget1="testdbf->field1"
wget2="testdbf->field2"
wget3="testdbf->field3"
@ 1, 1 DCSAY "Get 1" GET &wget1
@ 2, 1 DCSAY "Get 2" GET &wget2
@ 3, 1 DCSAY "Get 3" GET &wget3
DCREAD GUI addbuttons enterexit TITLE 'Macro GET Test'
dcmsgbox field1,field2,field3
RETURN
I found the source of the problem in _dcgetbx.prg
In FUNCTION DC_GetAnchorCB(....
Code: Select all
RETURN {|x,y,z|GetSetAliased(x,y,z,uVar,cAlias)} <<<< Remove this line
/* <<<< Remove this line
RETURN {|x,y,z,l| ;
IIF(Valtype(y)=='O' .AND. IsMemberVar(y,'DATAALIAS'), ;
y:dataAlias := cAlias,nil), ;
IIf( x==nil .OR. uVar==x, uVar, ;
(l:=!(cAlias)->(RecNo())$(cAlias)->(dbRLockList()), ;
IIF(l,(cAlias)->(dbRLock()),nil), ;
uVar:=x, ;
IIF(l,(cAlias)->(dbRUnlock()),nil)))}
*/ <<<< Remove this line
It restore this part of the code to the exp 266 version.
I think it is not the best solution, because there was a reason why You changed it, and it can cause other problems I am not aware now.
Best regards,
Zoltan