Setting conditions

You use the hook BWG_HOOK_SET_CONDITIONS to set error, warning or information conditions in a handle so that you can access the relevant message strings. You can use this to retrieve and then display the messages for any conditions set during a validation.

The parameters for the hook are:

BWI_V_PAR1 Set to a list of condition types, (BWI_N_ERROR, BWI_N_WARNING or BWI_N_INFORMATION) separated by colons (:) and terminated with 0 (BWI_N_NONE)
BWI_V_PAR2 Set to a colon separated list of condition values, one value for each condition type.

For example: BWI_V_PAR1 = 2:3:4:0 and BWI_V_PAR2 = 10:11:12 sets the conditions: Error 10, Warning 11 and Information 12.

Use the hook to set the conditions in the handle and then use BWINext and BWIGetString to access the text.

For example:

BWICreateHandle(h)

/* You must set a country to use hooks */

BWISetValue(h,BWI_V_COUNTRY_CHECK,BWI_C_UK)

/* Build the string listing the condition types */

string = BWI_N_ERROR + ":0"

BWISetString(h,BWI_V_PAR1,string)

/* And the string containing one or more conditions */

string = BWG_E_MODULUS_CHECK

BWISetString(h,BWI_V_PAR2,string)

/* Run the hook */

BWIHook(h,BWG_HOOK_SET_CONDITIONS)

/* If required loop through the conditions. This only has one condition set, so no need to loop */

BWINext(h,BWI_N_ERROR)

BWIGetString(h,BWI_V_NEXT,string)

print(string)

BWIFree(h)

This prints "Modulus check has failed".