In the context of Console UI, you can
use positional entries in a set-value
block (see
Set-values blocks) to assign
value
to successive elements in an array of any of these types:
- ConsoleField
- Menu
- MenuItem
- Prompt
When you
declare a dynamic array, you can specify the initial number of
elements, as in the following example:
col1 ConsoleField[5];
Assignments in a set-values block refer to properties
and predefined fields
in each of the initial ConsoleField type elements, though not to any
elements
that are added later:
col1 ConsoleField[5]
{
position = [1,1],
color = red
};
To assign values to a particular element in a variable
declaration, create
an embedded set-values block whose scope is that element. As the following
example shows, you specify the scope by using the keyword
this with
a bracketed index:
// assign values to the second and fourth element
col1 ConsoleField[5]
{
this[2] { color = blue },
this[4] { color = blue }
};
For information about another use of the this keyword,
see The "this" keyword.
The following
example is legal in an
openUI statement.
The scope of each embedded set-values block is a specific array element:
new Menu
{
labelText = "Universe",
MenuItems =
// property value is a dynamic array
[
new MenuItem
{ name = "Expand",
labelText = "Expand" },
new MenuItem
{ name = "Collapse",
labelText = "Collapse" }
]
}