Creates a menu window that displays a series of options.
|
OptionNumber := Dialog.STRMENU(OptionString [, DefaultNumber] [, Instruction])
|
Parameters
- OptionString
-
Type: Code or text constant
A comma-separated string. Each substring in OptionString denotes
an option on the menu. The string can be a text constant that is
enabled for multilanguage functionality. For more information, see
Working with
Multilanguage Functionality.
- 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.
- Instruction
-
Type: Code or text constant
Use this optional parameter to add a description to the option
values.
Property Value/Return Value
Type: Integer
The number of the menu option that the user selected. If the
user presses ESC to exit the menu, zero (0) is returned.
Example
This example shows how to use the Dialog.STRMENU
function.
This code example requires you to create the following
text constants and variables in the C/AL Globals window.
Text Constant
|
Const Value ENU Value |
Text000
|
'Save,Delete,Exit,Find ...'
|
Text001
|
'You selected option%1.'
|
Text002
|
'Choose one of the following options:'
|
Variable
|
Data Type
|
Length
|
Options
|
Text
|
30
|
Selected
|
Integer
|
|
|
Copy Code |
Options := Text000
// Sets the default to option 3
Selected := Dialog.STRMENU(Options, 3, Text002);
MESSAGE(Text001, Selected);
|
The menu window displays the following text:
Choose one of the following optons:
Save
Delete
Exit
Find …
Option 3, Exit, is highlighted. The option that the
user selects is stored in the variable Selected and the following message is
displayed:
You selected option 3.
See Also