|
VADELIA |
|
|
|
(I/B) (C/S) |
Section for use
DECLARATION
Syntax
GRAPHIC_OBJECT(<OBJECT_NAME> | *WINDOW | *MENU_ITEM ) <GraphicObjVariableName> [*DEF<AdeliaDefinition>]
Description
Declaration of a graphic object variable named GraphicObjectVariableName; the variable is a graphic object if <OBJECT_NAME> is specified, a window if *WINDOW is used, or a menu item if *MENU_ITEM is used. The purpose is to enable generic code to be written for an object type, or to allow graphic object to be manipulated away from its program (this is useful for child windows, for example).
<OBJECT_NAME> is one of the graphic objects defined at environment level. (Example: TREE_VIEW, CHECK_BOX, BUTTON, ENTRY_FIELD, OUTPUT_FIELD, etc.)
This graphic object variable can then be assigned and the object's instantiated properties manipulated.
However, only properties with fixed types can be manipulated directly. You use the customary syntax to access these properties with specified Adelia types:
MyGraphicObjVar:Property.
With properties for which the type is set during the layout design process (e.g. VALUE), you must use mixed type properties in the 4GL language, via a type forcing instruction (Cast). To access a mixed type property, you MUST force the property's type, whether it is used in read and/or write mode. You can force the type either directly via an Adelia type definition, or via a variable that incorporates the Adelia definition (type, length and number of decimals).
Note:
The cast must exactly match the type of the property of the object designated by the graphic object variable, failing which memory overwriting errors could occur when the program is run.
The definition of the VALUE property is forced by *DEF
It is possible to stipulate the Adelia type (i.e. the type, length and decimals) of the VALUE property by adding the *DEF(definition) keyword. The graphic object must have a VALUE property.
Example:
GRAPHIC_OBJECT(ENTRY_FIELD) MyObjectField1 *DEF(NUM_BIN_4)
GRAPHIC_OBJECT(ENTRY_FIELD) MyObjectField2 *DEF(ALPHA(12))
GRAPHIC_OBJECT(ENTRY_FIELD) MyObjectField3 *DEF(NUM_E(3,2))
This syntax can be used to declare a generic object with a VALUE property of a specified type, in which case, the VALUE property is no longer a mixed type, and cannot therefore be used with a cast instruction.
Example:
MyObjectField1 = MyWindow.MyNumericalField
MyObjectField1:VALUE = 444
MyObjectField2 = MyWindow.MyALPHAField
IF MyObjectField2:VALUE = 'blablabla'
..
END
This syntax can also be used to implicitly declare the list for a GRAPHIC_OBJECT variable with the LIST property.
Example:
GRAPHIC_OBJECT(COLUMN) MyColumnVar *DEF(NUM_E(5,2))
The column's list property is defined as a single column in NUM_E(5,2).
As MyColumnVar is a COLUMN object, it has the LIST property. In order to use this LIST property, the LIST's definition must be known, which is achieved here via *DEF.
To declare the LIST property of a GRAPHIC_OBJECT variable, you must use the LIST instruction. In this case, the GRAPHIC_OBJECT variables in the LIST must be declared using *DEF, so that the LIST has a definition (rather than being made up of MIXED fields).
Example:
GRAPHIC_OBJECT (COLUMN) COL1_OBJ_VAR *DEF(NUM_BIN_4)
GRAPHIC_OBJECT (COLUMN) COL2_OBJ_VAR *DEF(ALPHA(12))
GRAPHIC_OBJECT (COLUMN) COL3_OBJ_VAR /* i.e. with no definition
GRAPHIC_OBJECT(LIST) LIST_OBJ_VAR
LIST LIST_OBJ_VAR:LIST COL_OBJ_VAR1 COL_OBJ_VAR2 /* correct: 2 fields declared
LIST LIST_OBJ_VAR:LIST COL_OBJ_VAR1 COL_OBJ_VAR3 /* not permitted because COL3_OBJ_VAR is mixed
Notes:
GRAPHIC_OBJECT variables:
- cannot be used in data structures (DS);
- cannot be used as list fields;
- can be manipulated in the client part of a VA_I, MA_I or VA_B program;
- can be used as formal parameters in a VA_I, MA_I or VA_B program or client procedure;
Properties of GRAPHIC_OBJECT variables can be handled in the client and server parts of VA_I, MA_I or VA_B programs.
Mixed properties of GRAPHIC_OBJECT variables cannot be used as data structure fields.
Window names designated by Adelia instructions (EXECUTE, INITIALIZE, etc.) cannot be replaced with *WINDOW type GRAPHIC_OBJECT variables.
Unary assignment of GRAPHIC_OBJECT variables is only possible in client parts.
The Java client is not supported.
Examples
Example 1
GRAPHIC_OBJECT(ENTRY_FIELD) MyFieldGraphicObject
MyFieldGraphicObject = MYWINDOW.MYEF
MyFieldGraphicObject:VISIBILITY = *FALSE
MyFieldGraphicObject:LENGTH = 111
MyFieldGraphicObject = MyGraphicObjectTwo
Example 2
GRAPHIC_OBJECT(*WINDOW) MyWindowObject
MyWindowObject = MYWINDOW
MyWindowObject:VISIBILITY = *TRUE
MyWindowObject:WIDTH = 666
Example 3
GRAPHIC_OBJECT(*MENU_ITEM) MyMenuItemObject
MyMenuItemObject = MYWINDOW[MYMENU]
MyMenuItemObject:TEXT = 'updates the menu text'
MyMenuItemObject:CHECKED = *TRUE
Example 4
GRAPHIC_OBJECT(LIST) LIST_OBJ_VAR