Patricia Cu
Programmer
Hello,
I have a tree control that uses recursion to lookup data in the database to create child nodes and at the same time set them to Checked when multiple selection of nodes is enabled.
The code looks like the sample provided on another thread with similar title to this one. Basically: TREE.CHECKNODE event calls a custom method in its parent container/form, and this method calls itself - code shown below.
We apply the same logic to several tables that have the same hierarchy.
However, we recently encountered an issue with a new table that follows the same hierarchy as the other ones.
We hit the Insufficient Stack Space message for one particular set of codes in the new table.
We already tried setting the STACKSIZE value to 64000 in the config.fpw file, but that did not help.
Could anyone provide any other suggestions on how to address this issue?
Thank you for any help you can provide.
Regards,
Patricia Cu
I have a tree control that uses recursion to lookup data in the database to create child nodes and at the same time set them to Checked when multiple selection of nodes is enabled.
The code looks like the sample provided on another thread with similar title to this one. Basically: TREE.CHECKNODE event calls a custom method in its parent container/form, and this method calls itself - code shown below.
We apply the same logic to several tables that have the same hierarchy.
However, we recently encountered an issue with a new table that follows the same hierarchy as the other ones.
We hit the Insufficient Stack Space message for one particular set of codes in the new table.
We already tried setting the STACKSIZE value to 64000 in the config.fpw file, but that did not help.
Could anyone provide any other suggestions on how to address this issue?
Thank you for any help you can provide.
Regards,
Patricia Cu
Code:
*** OLE Control CHECKNODE Event ***
LPARAMETERS node
local lval
thisform.startwait
lval = node.checked
with this.parent.parent
if type('node.child.key') <> 'U'
.checknodes(node.child,lval)
endif
if lval
.btnok.enabled = .t.
endif
endwith
thisform.endwait
node = .f.
Code:
*******parent.parent container CHECKNODES method*****************
lpara node, lval
this.gtree1.treecontrol.expand(node.parent)
node.checked = lval
if type('node.child.key') <> 'U'
this.checknodes(node.child,lval)
endif
if type('node.next.key') <> 'U'
this.checknodes(node.next,lval)
endif
node = .f.
Code:
********parent.parent container EXPAND method********
**setup sql statement
**run sql statement and create nodes with the resulting cursor
**also set attributes for the nodes
with this.nodes
ogx.odbm.execsql(thisform.datasessionid,sSql,'branch')
msele = sele()
select('branch')
scan
if dispcode = code
cTitle = nvl(alltrim(dispcode),' ')+' '+alltrim(desc1)+' '+alltrim(str(lev))
else
cTitle = substr(alltrim(own),1,len(alltrim(own)))+' '+nvl(alltrim(dispcode),' ')+' '+alltrim(desc1)+' '+alltrim(str(lev))
endif
mnode = .Add(mRK+own,4,mRK+code, alltrim(cTitle))
mnode.bold = iif(dtflg = 1 and this.parent.parent.seltyp<3,.t.,.f.)
if type('mnode.tag') = "C"
if this.parent.parent.seltyp > 2
if dtflg = 1
mnode.tag = substr(alltrim(own),1,len(alltrim(own)))
else
mnode.tag = dispcode
endif
else
if dtflg = 1
mnode.tag = dispcode
else
mnode.tag = ""
endif
endif
endif
endscan
select(msele)
endwith
mnode = .f.