ADELIA |
VADELIA |
SADELIA |
WADELIA |
MADELIA |
(I/B) |
(I/B) (C/S) |
(S) |
(I/B) (C/S) |
(I) (C/S) |
Warning: In the case of ADELIA programs, this instruction is not compatible with the Adelia Studio C generator or with Adelia/400.
Section for use
All
Syntax
IF_VALUE SeriesValues
SeriesValues |
→ |
SeriesValues Constant | SeriesValues ReservedWord | SeriesValues Control | SeriesValues Window | SeriesValues Menu | Constant | ReservedWord | Control | Window | Menu |
Description
This instruction is found within a SWITCH/END_SWITCH block.
If the value of the SWITCH expression corresponds to one of the values present in SeriesValues then all the instructions following this instruction should be executed, until the next IF_VALUE or OTHER_VALUE or END_SWITCH for the SWITCH that this IF_VALUE depends on. We then exit the SWITCH/END_SWITCH block.
The type of constants or reserved words must correspond to the type of expression defined in the SWITCH instruction.
With a SWITCH instruction involving a GRAPHIC_OBJECT variable, SeriesValues MUST be the same type as set for SWITCH (i.e. Control, Window or Menu).
Only the use of *NULL_OBJECT in an IF_VALUE instruction is common to the three possible types for SWITCH (Control | Window | Menu).
For a SWITCH/END_SWITCH block, you can have as many IF_VALUE as you want.
Moreover, for a given SWITCH, there cannot be an IF_VALUE after an OTHER_VALUE.
At runtime, the IF_VALUE instructions are tested depending the order in which they appear in the source.
Example 1
SWITCH WCODE
IF_VALUE 12 15 25
WCODE = WCODE * 3
WTYPE = '1'
IF_VALUE 7 8
WCODE = WCODE * 2
WTYPE = '2'
OTHER_VALUE
WCODE = WCODE + 1
WTYPE = *BLANK
END_SWITCH
Example 2
/* GRAPHIC_OBJECT(ENTRY_FIELD) MyFieldObject */
SWITCH MyFieldObject
IF_VALUE MyWindow.FieldA
...
IF_VALUE MyWindow.FieldB
...
IF_VALUE *NULL_OBJECT
...
OTHER_VALUE
...
END_SWITCH
Example 3
* GRAPHIC_OBJECT(*WINDOW) MyWindowObject */
SWITCH MyWindowObject
IF_VALUE MyWindowA
...
IF_VALUE MyWindowB
...
IF_VALUE *NULL_OBJECT
...
OTHER_VALUE
...
END_SWITCH
Example 4
/* GRAPHIC_OBJECT(*ITEM_MENU) MyMenuItemGraphicObject */
SWITCH MyMenuItemGraphicObject
IF_VALUE WIN_NAME[MENU1_NAME]
...
IF_VALUE WIN_NAME[MENU2_NAME]
...
IF_VALUE *NULL_OBJECT
...
OTHER_VALUE
...
END_SWITCH