11.1 General Utilities
int MsgPrint(char *title, int icon, char *msg, int flags, FILE *log, ...);
This is the general function for presenting the user with an error or warning message.
titleis a string that is used for the title of the error dialog.
iconis the ID of an icon to be displayed next to the title; the available icons arenoteIcon,noteCautionIcon,cautionIcon,extraCautionIcon,stopIcon, andbombIcon. If icon has a priority low enough, then an option may be one so that the dialog is never presented to the user; in this case, a "default" button hit is simulated.
msgis the actual message to be presented to the user. An error ID can be included at the end of the string by placing it in curly braces (e.g. "Error... {E1}" is an error strng with ID "E1").
flagsdetermines which buttons will be available and which button is the default. It may also designate that an alternate button name is being passed in after the required parameters.flagsshould be the sum of one or more the following constants:
ALLOW_EXIT- Allows the Exit button to be hit.
ALLOW_EXTRA- Allows the Extra button to be hit.
ALLOW_CANCEL- Allows the Cancel button to be hit.
ALLOW_OK- Allows the OK button to be hit.
EXIT_DEFAULT- Makes Exit the default button.
EXTRA_DEFAULT- MakesExtra the default button.
CANCEL_DEFAULT- Makes Cancel the default button.
OK_DEFAULT- Makes OK the default button.
RENAME_EXIT- Rename the Exit button.*
RENAME_EXTRA- Rename the Extra button.*
RENAME_CANCEL- Rename the Cancel button.*
RENAME_OK- Rename the OK button.*
SET_SKIPPED- Set the button to be "hit" if the dialog is not displayed.*
USE_EVENT_PROC- Replace the standard event loop.*
NULLIFY_CANCEL- Don't call the standard cancel routine if Cancel is hit.Constants marked by an asterisk (*) above require extra parameters to be passed after the
logparameter. If multiple extra parameters are passed in, they should be ordered according to how the flags are ordered in the above list. TheRENAME_...flags require that a string be passed in for the new button name;SET_SKIPPEDrequires one of the four return values ofMsgPrint()(see below);USE_EVENT_PROCrequires a function pointer with prototypevoid func(int *)which should return every time the user hits something in the dialog, placing the item ID in*hit.
logshould beLogFPif the error and the user's response should be recorded in the log file, orNULLif it should not.
MsgPrint()returnsMSG_EXTRA,MSG_OK, orMSG_CANCEL, depending on which button the user hit.MSG_CANCELwill only be returned if theNULLIFY_CANCELflag is on; otherwise, the standrad cancel routine will be called, which will generally not return control to the caller ofMsgPrint().
extern char err_msg[ERR_MSG_BUF_SIZE]; #define ERR_MSG_BUF_SIZE 256
err_msgis available for temporary use to compose error message strings.
Generated with CERN WebMaker