編集

次の方法で共有


Dialog.StrMenu(Text [, Integer] [, Text]) Method

Version: Available or changed with runtime version 1.0.

Creates a menu window that displays a series of options.

Syntax

OptionNumber :=   Dialog.StrMenu(OptionMembers: Text [, DefaultNumber: Integer] [, Instruction: Text])

Note

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

Parameters

OptionMembers
 Type: Text
A comma-separated string. Each substring in OptionString specifies an option on the menu. The string can be a label that is enabled for multilanguage functionality.

[Optional] DefaultNumber
 Type: Integer
Use this optional parameter to determine a default option, which is highlighted. The options are numbered 1, 2, 3, 4, and so on. If you omit this optional parameter, the first option (1) is used as the default.

[Optional] Instruction
 Type: Text
Use this optional parameter to add a description to the option values.

Return Value

OptionNumber
 Type: Integer
The number of the menu option that the user selected. If the user presses the Esc key to exit the menu, zero (0) is returned.

Example

This example shows how to use the Dialog.StrMenu method.

var
    Options: Text[30];
    Selected: Integer;
    Text000: Label 'Save,Delete,Exit,Find';
    Text001: Label 'You selected option %1.';
    Text002: Label 'Choose one of the following options:';
begin
    Options := Text000;  
    // Sets the default to option 3  
    Selected := Dialog.StrMenu(Options, 3, Text002);  
    Message(Text001, Selected);  
end;

The menu window displays the following text:

Choose one of the following options:

Save

Delete

Exit

Find

Option 3, Exit, is highlighted. The option that the user selects is stored in the variable Selected. The user receives following message:

You selected option 3.

Dialog Data Type
Get Started with AL
Developing Extensions