
27
Programming Concepts
3.5.3
Detect Format Errors
If the format matches a known format that should not be used in the current application
context, the application can send a warning message, which is displayed in "warning"
form.
else if data matches wrong formats
{
warning.text = "bad code for this application";
gui.showForm(warning);
return null;
}
In this case, the example returns a
null
to consume the decode.
Note!
Do not code
alert
,
confirm
, or
prompt
, either as functions or as gui methods, in an
onDecode or onCommand event handler. The events originate in the handheld firmware,
resulting from decodes, commands, or communication events. While the event handler is
running, the main application is held idle until the event handler returns. If the event handler is
waiting for the user to finish with
alert
,
confirm
, or
prompt
, the main application will be
forced to wait as well, resulting in timeout errors.
3.5.4
Let the Handheld Process the Decode
If you want the handheld to process the decode, set the decode as the return statement
parameter. If you have changed decode data and want the changes available to the
handheld, set the appropriate data field in the decode to the changed value before
returning the decode.
else // code should be processed by handheld firmware
{
if ( code should be processed
with transformed data)
{
decode.data = data; // replace the data field
// with transformed data
}
return decode;
}