AMT Help Files

Change field attributes on runtime

With the change attribute command, form field attributes (layout control properties) can be changed on run time.

This command can only be used in the FORM-TO-WS or WS-TO-FORM logic of a CobolForm.

 

The syntax for this command is as follows:

CHANGE [ATTRIBUTE] <Attribute> OF <FieldName> TO <Value>

Note: the keyword 'ATTRIBUTE' is optional.


Parameter Description
<Attribute> The attribute to be changed, possible attributes are listed in the table below.
<FieldName> The name of a form field (layout control).
<Value> The new value of the form field attribute.

Attributes Description Value type
ENABLED  Enable or disable a layout control, enabled is not supported for labels. <Boolean> (TRUE/FALSE) 
FONTBOLD Determines whether or not the text (caption) in the control must be displayed in bold.  <Boolean> (TRUE/FALSE) 
FONTITALIC Determines whether or not the text (caption) in the control must be displayed italicized.  <Boolean> (TRUE/FALSE) 
FONTUNDERLINE Determines whether or not the text (caption) must be displayed underlined. <Boolean> (TRUE/FALSE) 
LEFT Number of pixels space before the control. If the control is related to a parent, then the number of space is measured from the beginning (left) of the parent until the beginning of the control. Otherwise, the space is measured from the beginning of the form. <Numeric> 
TOP  Position where the control is painted. If the control is related to a parent, the value indicates the number of pixels between the top position of the control and the top position its parent. Otherwise, the value indicates the number of pixels between the top of the control and the top of the form.  <Numeric> 
VISIBLE  If set "FALSE", then the control will not be shown at runtime.  <Boolean> (TRUE/FALSE) 

Example:

PROCEDURE DIVISION.

WS-TO-FORM SECTION.
INIT-WS-TO-FORM.

     CHANGE ATTRIBUTE ENABLED OF COMPANYNAME TO FALSE.
     CHANGE ATTRIBUTE VISIBLE OF VATNR TO FALSE.
     CHANGE ATTRIBUTE FONTUNDERLINE OF CUSTOMERTYPE TO TRUE.
     CHANGE LEFT OF PHONENR TO 50.
     CHANGE TOP OF PHONENR TO 150.

EXIT-WS-TO-FORM-END.
     EXIT.

...