Using POINTs and BLOCKs
POINT
and BLOCK
sections are the areas in the generated
code where you can add your own code.
Any code added in a POINT
or BLOCK
is
preserved in the application even when the application is rebuilt.
Code added to a
POINT
or BLOCK
section is
preserved in a .code file that is used each time the application is compiled.
If you are using Source Code Management, the .code file must be committed
with the project. It is not necessary to commit the generated 4gl files. Tip: To remove all changes you have made, you can simply remove the .code
and all generated 4gl files.
POINT
POINT
sections are
located within each function BLOCK
. The more granular POINT
sections are located in all relevant locations for adding business logic such as in all control
blocks (BEFORE ROW
, AFTER INPUT
, ....). Common uses of a
POINT
include defining your own variables, setting conditions on
SELECT
statements, adding or modifying actions in control blocks of interactive
dialogs such as CONSTRUCT
, INPUT
, MENU
, and
changing the program flow. Note: You are responsible for the validity of the code in a
POINT
.
Description | POINT name | Example |
---|---|---|
Import an additional module(s). | import |
|
Add comments in the code. | comment |
|
Define modular scope variables. | define |
|
Define local scope variables. | function.define |
|
Add additional function(s) to the module. | user.functions |
|
Add additional actions for each of the interactive dialog statements
(DISPLAY , DISPLAY
ARRAY , CONSTRUCT , INPUT , INPUT
ARRAY and MENU ). |
userControlBlocks |
|
BLOCK
Each function in the generated code is nested within a
BLOCK
section. Note: You
can change the behavior of the generated function, however once new code has been added to a
BLOCK
, you take responsibility for the validity of all the code in that
BLOCK
.Status attribute
During the first application generation,
POINT
and BLOCK
sections will only contain
the Name
attribute.{<POINT Name="fct.uiDisplay.dlg.userControlBlocks">}{</POINT>}
When
the code is changed, the POINT
and BLOCK
will include
a Status
attribute set to
MODIFIED
.{<POINT Name="fct.uiDisplay.dlg.userControlBlocks" Status="MODIFIED">}
ON ACTION test
MESSAGE "testing..." {
</POINT>}