We have had a couple of issues where a single JPG that is in some way corrupted causes errors in our application.
Is there any way we can trap these before the error occurs and substitute the corrupted image with a good / blank one so the dcbrowse shows without errors?
------------------------------------------------------------------------------
ERROR LOG of "C:\rba-share\rba\rba32.exe" Date: 03/07/2012 08:14:40
Xbase++ version:Xbase++ (R) Version 1.90.355
Operating system:Windows Server 2003 05.02 Build 03790 Service Pack 2
------------------------------------------------------------------------------
oError:args :-> VALTYPE: O - CLASS: XbpCellGroup
-> VALTYPE: N - VALUE: 9
-> VALTYPE: C - VALUE: C:\rba-share\rba\Live\products\GDN00112%2FA.jpg
-> VALTYPE: N - VALUE: 2
-> VALTYPE: L - VALUE: .F.
oError:canDefault :.F.
oError:canRetry :.F.
oError:canSubstitute:.T.
oError:cargo :NIL
oError:description : Parameter has a wrong data type
oError:filename :
oError:genCode :2
oError:operation ::SetCell
oError:osCode :0
oError:severity :2
oError:subCode :3
oError:subSystem :BASE
oError:thread :5
oError:tries :0
------------------------------------------------------------------------------
CURRENT DATABASE:
------------------------------------------------------------------------------
Alias(): NEWPLU Record: 168 Index: 1,NEWPLU1
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Called from (B)ERRORSYS(54)
Called from XBPCOLUMN:DRAWROW(678)
Called from DC_XBPCOLUMN:DRAWROW(2780)
Called from (B)XBPBROWSE:DRAWROW(2131)
Called from XBPBROWSE:DRAWROW(2131)
Called from XBPBROWSE:FORCESTABLE(1143)
Called from XBPBROWSE:HANDLEEVENT(1497)
Called from DC_XBPBROWSE:HANDLEEVENT(905)
Called from DC_GETLIST:EVENTLOOP(4449)
Called from DC_GETLIST:READGUI(3677)
Called from DC_READGUI(101)
Called from PLU_BROWSER(856)
Called from PLU_LOOKUP(13330)
Called from (B)CHECKOUT_SALES(2877)
Called from DC_XBPPUSHBUTTON:ACTION(2303)
Called from (B)DC_XBPPUSHBUTTON:INIT(1873)
Called from XBPPUSHBUTTON:HANDLEEVENT(964)
Called from DC_GETLIST:EVENTLOOP(4449)
Called from DC_GETLIST:READGUI(3677)
Called from DC_READGUI(101)
Called from CHECKOUT_SALES(4940)
Called from (B)XB_MENU(462)
Called from RUNFUNCTION(86)
Called from (B)RUN_PROCEDURE(73)
Express++ Version: eXPress++ (c) Version 1.9 Build 255
lLoaded := .F.
bError := ErrorBlock({|e|Break(e)})
BEGIN SEQUENCE
* Load picture file
lLoaded := .T." // after loading the file - it will not be set if the loading process fails!
END SEQUENCE
ErrorBlock(bError)
IF !lLoaded // something was wrong
* load picture replacement
ENDIF
If now an error occurs during the picture loading process, the runtime error system will not be started, but the sequence will end without setting "lLoaded", so you can deal with the error.
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
lLoaded := .F.
bError := ErrorBlock({|e|Break(e)})
BEGIN SEQUENCE
* Load picture file
lLoaded := .T." // after loading the file - it will not be set if the loading process fails!
END SEQUENCE
ErrorBlock(bError)
IF !lLoaded // something was wrong
* load picture replacement
ENDIF
If now an error occurs during the picture loading process, the runtime error system will not be started, but the sequence will end without setting "lLoaded", so you can deal with the error.
Thanks Tom
You pointed me in the right direction.
On creating the multi-dim array for the DCBROWSE the image was being loaded using:
What I didn't take into consideration is that the function call above will return a character string if the image could not be loaded. So I can change it to test for a return value of char and workaround it.
DC_GetBitmap() has always had that behavior.
I wrote it that way for pushbuttons, so it would display the name of the bitmap or jpg file on the button if the bitmap could not be found or loaded, rather than cause a runtime error.
Roger
The eXpress train is coming - and it has more cars.
DC_GetBitmap() has always had that behavior.
I wrote it that way for pushbuttons, so it would display the name of the bitmap or jpg file on the button if the bitmap could not be found or loaded, rather than cause a runtime error.
Roger
That's fine Roger. It was probably my fault for not reading the docs correctly...