편집

다음을 통해 공유


Dialog.Confirm(Text [, Boolean] [, Any,...]) Method

Version: Available or changed with runtime version 1.0.

Creates a dialog box that prompts the user for a yes or no answer. The dialog box is centered on the screen.

Syntax

Ok :=   Dialog.Confirm(String: Text [, Default: Boolean] [, Value1: Any,...])

Note

This method can be invoked without specifying the data type name.

Parameters

String
 Type: Text
Specifies the string that is displayed in the dialog box. Use a backslash (\) to indicate a new line. The string can be a label that is enabled for multilanguage functionality.

[Optional] Default
 Type: Boolean
Specifies the default button. If you do not specify a default button, then No is used as the default button.

[Optional] Value1
 Type: Any

Return Value

Ok
 Type: Boolean

Remarks

The message window is automatically sized. The height of the window corresponds to the number of lines and the width corresponds to the length of the longest line.

We recommend that you always end Confirm messages with a question mark. For more information about best practices for end-user messages, see Progress Windows, Message, Error, and Confirm Methods.

Example

In the following example, the Dialog.Confirm method prompts the user for a true or false answer.

var
    Question: Text;
    Answer: Boolean;
    CustomerNo: Integer;
    Text000: Label 'Exit without saving changes to customer %1?';
    Text001: Label 'You selected %1.';
begin
    CustomerNo := 01121212;  
    Question := Text000;  
    Answer := Dialog.Confirm(Question, true, CustomerNo);  
    Message(Text001, Answer);  
end;

The first dialog box shows:

Exit without saving changes to customer 1121212?

If you select the default true value, then the second dialog box is shown:

You selected true.

Dialog Data Type
Get Started with AL
Developing Extensions