Navigation: Language Reference > 13 - Built-in Functions >====== CHANGE (change control field value) ====== | |
CHANGE(control,value)
CHANGE | Changes the value displayed in a control in an APPLICATION or WINDOW structure. |
control | Field number or field equate label of a window control field. |
value | A constant, variable, or valid expression containing the control's new value. |
The CHANGE statement changes the value displayed in a control in an APPLICATION or WINDOW structure. CHANGE updates the control's USE variable with the value, clears all pending events, and then displays that new value in the control field.
For example:
CHANGE(?dLocator, CLIP(dLocator) & 'D')
Example:
Screen WINDOW,PRE(Scr)
ENTRY(@N3),USE(Ctl:Code)
ENTRY(@S30),USE(Ctl:Name)
BUTTON('OK'),USE(?OkButton),KEY(EnterKey)
BUTTON('Cancel'),USE(?CanxButton),KEY(EscKey)
END
CODE
OPEN(Screen)
ACCEPT
CASE EVENT()
OF EVENT:Selected
CASE SELECTED()
OF ?Ctl:Code
CHANGE(?Ctl:Code,4) !Change Ctl:Code to 4 and display it
?Ctl:Code{PROP:Touched} = TRUE !Force Accepted Event
OF ?Ctl:Name
CHANGE(?Ctl:Name,'ABC Company') !Change Ctl:Name to ABC Company and display
?Ctl:Name{PROP:Touched} = TRUE !Force Accepted Event
END
OF EVENT:Accepted
CASE ACCEPTED()
OF ?OkButton
BREAK
OF ?CanxButton
CLEAR(Ctl:Record)
BREAK
END
END
See Also: