I have following issue. At random looking at my code, i discoffered a real issue of bad programming from my site of cource !
Using 90% of Xbrowse time in my program, Xbrowse performance is essential, so I need to do it correct.
I put a controlling function "GetOrgfoto" to see how many times it will be called while running my program.
- Code: Select all Expand view RUN
- function getorgfoto(cFoto)
nErrorTel ++
cFoto="d:\pictures\origineel\"+alltrim(cFoto)
aadd(aErrordata,cFoto)
if !file(cFoto)
cFoto = "d:\pictures\origineel\nofoto.jpg"
endif
return cFoto
function showpicture(cType)
do case
case cType = "WEBSHOP_KLEUREN"
for I = 1 to 12
cColor = "webshop->color"+alltrim(str(i))
if empty(cColor)
aGaleryNaam[i] = "Geen Kleur"
else
aGaleryNaam[i] = &cColor
endif
oGaleryNaam[i]:refresh()
oGaleryNaam[i]:show()
next
case cType = "EAN_BASIS"
....
endcase
oSys_image:refresh()
oText[3]:refresh() // Supet TXT
oText[4]:refresh() // Naam
oText[5]:refresh() // Lev. SuperTXT
return
From Xbrowse i do :
- Code: Select all Expand view RUN
oBrw:bChange := { || showpicture("WEBSHOP_KLEUREN"),oBrw:refresh() }
WITH OBJECT oBrw // General for all browsers
case cData = "WEBSHOP_KLEUREN"
WITH OBJECT :Akt
:AddBitmap( aBmp )
:bBmpData := { || if( ( oBrw:cAlias )->aktief = 1,1,2) }
END
WITH OBJECT :Cover
:nEditType := EDIT_GET_BUTTON
:bStrImage := { || getorgfoto(webshop->orgfoto) }
:bEditBlock := { |r,c,oCol| EanfotoSelect( oCol:Value ) }
:oDataFont := oFontXS
:nDataStrAlign := AL_CENTER + AL_BOTTOM
:nDataBmpAlign := AL_CENTER
END
if lCheck[CHK_FOTOGALERY]
oBrw:nRowHeight:= 99
oBrw:nFootStrAligns := AL_CENTER
for i = 1 to 12
cPic = "pic"+alltrim(str(i))
cColor = "color"+alltrim(str(i))
WITH OBJECT:&cpic
:nEditType := EDIT_GET_BUTTON
:bStrImage := { || getorgfoto(webshop->&cPic) }
:bFooter := { || alltrim( webshop->&cColor ) }
:bEditBlock := { |r,c,oCol| EanfotoSelect( oCol:Value ) }
:oDataFont := oFontXS
:nDataStrAlign := AL_CENTER + AL_BOTTOM
:nDataBmpAlign := AL_CENTER
END
next
endif
What happens :
Just opening the program and the array (controling function) has 13 items
Clicking a foldertab to go to a selected xbrowse the items are : 169
Clicking on the browse with the right key 5 times, no edit, just move 5 celss to the right : items : 598
Moving up/down en left to right 2 times : Items : 1652
A dobble click will add more that 200 items
Clear that every movement is calling the function many many times....
Not only movement, but editing etc... is calling functions more than once at some times.
Clear that my fundamentals in programming xbrowse are wrong comming to the point how to use :
refresh() the browse, the cells , and the rows.... (HERE IT IS GOING WRONG)
How to move without calling any action ? It should not call one.
I know that when I digg into the forum and extract samples, I can get the issue solved, but the refresh stuff I do need to know !!
Please some advice ....
The browse :