version 6.0 (Modified)
CONFIRM (message{; OK button title{; cancel button title}})
Parameter | Type | Description | |
message | String | Message to display in the confirmation dialog box | |
OK button title | String | OK button title | |
cancel button title | String | Cancel button title |
Description
The CONFIRM command displays a confirm dialog box composed of a note icon, a message, an OK button, and a Cancel Button.
You pass the message to be displayed in the message parameter. This message can be up to 255 characters long. If the message does not fit into the message area, it can appear truncated, depending on its length and the width of the characters.
By default, the title of the OK button is "OK" and that of the Cancel button is "Cancel." To change the titles of these buttons, pass the new custom titles into the optional parameters ok button title and cancel button title. If necessary, the width of the buttons is resized toward the left, according to the width of the custom titles you pass.
The OK button is the default button. If the user clicks the OK button or presses Enter to accept the dialog box, the OK system variable is set to 1. If the user clicks the Cancel button to cancel the dialog box, the OK system variable is set to 0.
Tip: Do not call the CONFIRM command from the section of a form or object method that handles the On Activate or On Deactivate form events; this will cause an endless loop.
Examples
1. The line:
CONFIRM("WARNING: You will not be able to revert this operation.") If (OK=1) ALL RECORDS([Old Stuff]) DELETE SELECTION([Old Stuff]) Else ALERT ("Operation canceled.") End if
will display the confirm dialog box (on Windows) shown here:
2. The line:
CONFIRM("Do you really want to close this account?";"Yes";"No")
will display the confirm dialog box (on Windows) shown here:
3. You are writing a 4D application for the international market. You wrote a project method that returns the correct localized text from its English version. You have also populated an array named <>asLocalizedUIMessages,where you store the most common words. In doing so, the line:
CONFIRM(INTL Text ("Do you want to add a new Memo?");<>asLocalizedUIMessages{kLoc_YES}; <>asLocalizedUIMessages{kLoc_NO})
could display the French confirm dialog box (on Windows) shown here:
4. The line:
CONFIRM("WARNING: If your pursue this operation, some records will be "+"irremediably affected."+Char(13)+ "What do you want to do?";"Do NOT continue";"Continue")
will display the confirm dialog box (on Macintosh) shown here:
See Also