Trap error with Begin Sequence
Posted: Fri May 04, 2018 9:38 pm
Dear Friends,
I need help on the error trapping,
the code,
TIA
best rgds,
Chang
I need help on the error trapping,
the code,
TIA
best rgds,
Chang
Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
http://hmgforum.com/
Code: Select all
FUNCTION Main_List_1_OnChange()
LOCAL bErrHandler
LOCAL uResult
LOCAL cEditValue
LOCAL nValue := GetProperty( "Main", "List_1", "Value")
LOCAL cDisplayItem := ALLTRIM( GetProperty( "Main", "List_1", "Item", nValue))
// cDisplayItem := "getStartupFolder()"
LOCAL cCode := "{|x| " + cDisplayItem + "}"
bErrHandler := ErrorBlock({|| Break(NIL)})
BEGIN SEQUENCE
bCode := &cCode
uResult := EVAL( bCode)
RECOVER
msgDebug( "undefined function :", cCode)
END
ErrorBlock(bErrHandler)
IF VALTYPE( uResult) == 'C'
cEditValue := uResult + HB_EOL() + GetProperty( "Main", "Edit_1", "Value")
SetProperty( "Main", "Edit_1", "Value", cEditValue)
msgDebug( cDisplayItem, uResult)
ELSE
msgDebug( uResult)
ENDIF
RETURN NIL
Because HB_EOL() function is used in HMG code and HB_DiskSpace() function is nowhere used.
Code: Select all
#include <hmg.ch>
#define ZFMAIN Main
#define ZMFILE "&File"
#define ZMFILE01 "&Open"
#define ZSTTBAR01 "hfManager"
REQUEST HB_DiskSpace
REQUEST HB_BuildDate
FUNCTION Main()
...
Yes, all that will be called by the macro and are not explicitly used in the program code.
No. REQUEST is an instruction for the linker.