Hi everybody,
I got some strange behavior with SetAll. I instantiate a grid in form's Init method. Then I do:
thisform.grdBldMstr.SetAll('DynamicForeColor','thisform.myForeColor(BldMstr.'+thisform.addrfield+')','column)
.
Everything works fine so far. This is the code I have in Grid AfterRowColChange event:
lparameters nColIndex
local lnReccount, lnRecno
lnReccount=reccount('BldMstr')
lnRecno=recno('BldMstr')
with this
if .nCurRec<>m.lnRecno
.nCurRec=m.lnRecno
thisform.NavStand.navupdate()
thisform.edtNotes.refresh()
if thisform.ProcType='prclproc'
if thisform.grdSitus.visible or thisform.grdOwner.visible
thisform.RequeryGridSources()
endif
endif
endif
.statusbartext=space(20)+"Record "+ transform(m.lnRecno)+" of "+ transform(m.lnReccount)+ ;
" in BldMstr"
endwith
This is the code of RequeryGridSources method:
lparameter tnPropID
if vartype(m.tnPropID)<>"N"
tnPropID=BldMstr.PropID
endif
local lcDBC
if vartype(oJC)='O'
lcDBC=oJC.CurState
else
lcDBC='MA'
endif
set step on
with thisform
if .grdSitus.visible
.grdSitus.recordsource=''
select iif(prefcode='P',padr('Primary',11),'Alternative') as AddressType, ;
ccode, town, StNum, StNumExt, Street, LotCode, Unit, ZipCode ;
from (m.lcDBC+'!SiteMstr') where PropID=m.tnPropID ;
order by AddressType descending ;
into cursor curSitus
.grdSitus.recordsource='curSitus'
select BldMstr
endif
if .grdOwner.visible
.grdOwner.recordsource=''
select ownerstnum, ownerStExt, OwnerStrt, OwnerUnit, OwnerCity, ;
OwnerState, OwnerZip5, OwnerCtry ;
from (m.lcDBC+'!OwnrAddr') where PropID==m.tnPropID ;
into cursor curOwner
.grdOwner.recordsource='curOwner'
select BldMstr
endif
endwith
At the beginning I was trying to use GridHighlighter, but I noticed, then I change Grid height programmatically, thisform.myForeColor method fires again and again many times. Ok, I commented out lines with changing grid height, but then I navigate from record to record, thisform.myForeColor fires many times again. Finally I commented out lines with gridhighlighter, but I still got this problem. It looks like, if I change alias in grid AfterRowColChange method, I got SetAll method executing (this is my guess about that's actually happening). Can somebody confirm this behavior? What can I do about it? It slows down movement between records dramatically :((((((
If it's not broken, fix it until it is.
My Blog