[Previous] [Contents] [Index] [Next]

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 );

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. The arguments are:

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>.
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.

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:

PtAskQuestion()

PtMessage in the Widget Reference


[Previous] [Contents] [Index] [Next]