Wiki Diff IupAlarm, revision #1 to tip

=1
== IupAlarm
@serial = 685
===== dialog

==== Description
Shows a modal dialog containing a message and up to three buttons.
==== Include
iupw.e

iup.e
==== Namespace
iup
==== Signature
<eucode> public function IupAlarm(string title, string mess, string b1, object b2 = NULL, object b3 = NULL)</eucode>
<eucode> public function IupAlarm(object title = NULL, object msg = NULL, object b1 = NULL, object b2 = NULL, object b3 = NULL)</eucode>
==== Creation

# title: Dialog's title
# mess: Message
# b1: Text of the first button
# b2: Text of the second button (optional)
# b3: Text of the third button (optional)
[[[
t: Dialog’s title
m: Message
b1: Text of the first button
b2: Text of the second button (optional)
b3: Text of the third button (optional)
]]]
Returns: the number of the button selected by the user (1, 2 or 3) , or 0 if failed. It fails only if b1 is not defined.
]]]
==== Notes

This function shows a dialog centred on the screen, with the message and the buttons. The //\n// character can be added to the message to indicate line change.
This function shows a dialog centralized on the screen, with the message and the buttons. The ‘\n’ character can be added to the message to indicate line change.

A button is not shown if its parameter is NULL. This is valid only for b2 and b3.

Button 1 is set as the "DEFAULTENTER" and "DEFAULTESC". If Button 2 exists it is set as the "DEFAULTESC". If Button 3 exists it is set as the "DEFAULTESC".

The dialog uses a global attribute called "PARENTDIALOG" as the parent dialog if it is defined. It also uses a global attribute called "ICON" as the dialog icon if it is defined.
==== Example

<eucode>
include iupw.e
IupOpen()
include iup/iup.e
IupOpen(NULL)

? IupAlarm ("Alarm", "Click to continue", "click" ) -- WORKS

-- ? IupAlarm ("Alarm", "Click to continue" ) -- FAILS
-- needs button

IupClose()
IupMainLoop() IupClose()
</eucode>
==== Example

<eucode>
include iupw.e
IupOpen()
switch IupAlarm(caption, "File not saved! Save it now?", "Yes", "No", "Cancel") do
-- Shows a message for each selected button
case 1 then
IupMessage(PROMPT, "File saved successfully - leaving program")
break
case 2 then
IupMessage(PROMPT, "File not saved - leaving program anyway")
break
case 3 then
IupMessage(PROMPT, "Operation cancelled")
break
end switch
IupClose()
include iup/iup.e
IupOpen(NULL)

IupAlarm ("IupAlarm", "Alarm Message", "One", "Two", "Three")

IupMainLoop() IupClose()
</eucode>
==== See Also
| IupFileDlg | IupMessageDlg | IupFontDlg | IupProgressDlg | IupAlarm | IupGetFile | IupGetColor | IupGetParam | IupGetText | IupListDialog | IupMessage | IupScanf | IupLayoutDialog | IupElementPropertiesDialog |

Search



Quick Links

User menu

Not signed in.

Misc Menu