ApError()

Display an error message dialog

Synopsis:

#include <Ap.h>

void ApError( PtWidget_t *widget,
              int errnum,
              char const *app_prefix,
              char const *error_message,
              char const *location );

Arguments:

widget
A pointer to the parent widget for the error message dialog.
errnum
The standard errno value set by the operation that failed. The errno variable and its values are defined in <errno.h>, and are described in the QNX Neutrino Library Reference.
app_prefix
A string of prefix letters for identifying the application. For example, PhAB is the prefix for the Photon Application Builder.
error_message
The error text to be displayed.
location
The location in the code where the error occurred. If you don't want the location displayed, specify NULL.

Library:

Ap

Description:

ApError() displays an error message dialog on the screen. This is a modeless dialog that doesn't wait for a user response. It displays a formatted error message and a single OK button for acknowledgment.


ApError example


A sample dialog displayed by AppError().

ApError() builds the message, in order, from the following:

Examples:

If you call ApError() as follows, specifying the location:

ApError( ABW_base, errno, "PhAB", "Unable to save file",
         __FILE__ );

then the error dialog is formatted as:

PhAB: Unable to save file(Permission denied) in
(save_function.c)

In the example above, __FILE__ is a compiler directive to insert the name of the source file, and (Permission denied) is the string associated with the current value of errno.

If you make the same call, but omit the location:

ApError( ABW_base, errno, "PhAB", "Unable to save file",
         NULL );

then the error dialog is formatted as:

PhAB: Unable to save file(Permission denied)

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtAlert(), PtNotice(), PtPrompt()

Dialog modules in the Working with Modules chapter of the Photon Programmer's Guide