Derived from: None
Declared in: PAlert.h
This class is a helper class to show messages in a window. All it can do is to show a message and wait for the user to press one of the buttons to continue. This can be used to show informative or errors to the user, who need to respond on them.
PAlert(PString title, PString message, PAlertType type, PAlertButtons buttons, uint8 defButton = 0);
This will prepare the alert. The arguments are the title of the alert and the text you want to be shown in the alert. The PAlertType is the type of alert you want. This can be one of these values:
pInfo | The alert is some information to the user. |
pWarning | You need to warn the user about something. |
pStop | This can be used if you want to show an error or other information that really need the users attention. |
pQuestion | You want to ask the user about something. |
The PAlertButtons indicates which buttons you want in the alert. You can select between these buttons:
pAbortRetryIgnore |
pOk |
pOkCancel |
pRetryCancel |
pYesNo |
pYesNoCancel |
The last argument indicates which button you want to make the default button. The default button is the button where the user can press the enter key to activate. The default argument is the first button.
BeOS:
- If you have a cancel button, the user can press the escape key to activate that.
~PAlert()
~PAlert(void);
Will free the resources allocated.
Show()
PAlertButton Show(void);
This function will show the alert. You can call this function as many times you want. You can then create some default alerts ready to use and when needed, just call the Show() function on them. The button the user has activated is returned as an id number. You can then decide what to do. The id is one of the following:
pIDAbort |
pIDRetry |
pIDIgnore |
pIDOk |
pIDCancel |
pIDYes |
pIDNo |