Tip:
Highlight text to annotate it
X
0:00:08.000,0:00:12.000
Though the Business Application Modeler
generates the code for your application,
0:00:12.000,0:00:16.000
you can still add your own code to customize
the application as you see fit.
0:00:19.000,0:00:27.033
There are special areas of the generated 4gl files
called POINTs and BLOCKs for you to add your
own code. The code you add to POINT and
BLOCK sections are preserved even when the
application is regenerated as it is kept in a
special .code file that is used in the
building process.
0:00:38.033,0:00:45.033
First, it is important to understand that 4gl files
are generated for each implemented component
on your BA diagram and listed in the
0:00:45.033,0:00:47.033
Intermediate Files.
0:00:48.066,0:00:59.033
For a form component, you will see a
form_ui.4gl and form_uidata.4gl, where form is
the name of your form component.
0:01:00.033,0:01:07.066
Form_ui.4gl and Form_uidata.4gl are compiled
and linked with the other program files to create
the executable application.
0:01:08.066,0:01:12.066
These are the files where you find the POINT
and BLOCK sections.
0:01:14.033,0:01:20.000
Form_ui.4gl includes the MAIN and loads
resource files and does some preliminary setup
including launching the functions containing the
Menu or Dialog statements for the various
states. It also imports and calls functions in the
other generated file, Form_uidata.4gl.
0:01:30.000,0:01:37.000
Form_uidata.4gl defines records and handles
the create, retrieve, update, and delete data
routines (CRUD).
0:01:38.033,0:01:46.033
Now consider two examples of using a POINT
section to add code. In Video 8, you can see an
example of using a BLOCK section.
0:01:48.066,0:01:55.000
In the first example, you will see how to modify
the SELECT statement so that the application
only retrieves account records from the USA.
0:01:56.066,0:02:03.066
In the second example, you will see how to add
your own action to the program and have that
action call your own function.
0:02:12.000,0:02:15.066
To start open the file to which you want to add
code.
0:02:15.066,0:02:20.033
Here were an open the file Form1_uidata.4gl.
0:02:20.033,0:02:25.000
Now search for the POINT section that follows
the select statement you want to modify
0:02:25.000,0:02:28.000
Note that the POINT section has a name
0:02:28.000,0:02:35.000
here it's fct.Record1.getKeys.init
0:02:35.000,0:02:44.033
Between the point and end point tags add your
new select statement with the where clause
modified.
0:03:26.033,0:03:28.066
Now that the where clause
0:03:28.066,0:03:30.066
is modified to our liking,
0:03:30.066,0:03:34.066
we also have added an order by clause here,
0:03:34.066,0:03:43.000
go ahead and recompile and run the program to
see the results.
0:03:59.033,0:04:07.066
And as you can see the only records retrieved
are those from country USA.
0:04:17.033,0:04:24.000
For this example you'll see how to add code to 2
POINT sections in the Form1_ui.4gl file.
0:04:24.000,0:04:29.066
You'll create a new action that is available when
the user modifies the form.
0:04:29.066,0:04:32.066
When the action is triggered a message will
appear.
0:04:32.066,0:04:38.066
First find the interactive dialogue where you want
your action to be available since you want the
action available when the user is modifying the
form look for the input dialogue.
0:04:44.066,0:04:49.066
Each interactive ballot statement has an
AddControlBlocks point.
0:04:49.033,0:05:00.033
Here you see a
fct.uiInput.dialog.addControlBlocks, so add your
on action code here.
0:05:19.066,0:05:24.066
Now the very bottom of the 4gl file there is a
point for user functions.
0:05:24.066,0:05:27.033
Add your new function here.
0:05:38.066,0:05:46.066
Now regenerate a program and run it to see your
new action.
0:05:46.066,0:05:52.033
Note that when you go into an input mode such
as with the Modify button your new action
appears as a button on the form.
0:05:52.033,0:05:56.033
Select the button to see your message.
0:05:56.033,0:06:01.000
You can move this action to the toolbar or top
menu area instead of its default position on the
form.
0:06:01.000,0:06:06.033
See video number 5 on Modifying the Topmenu
and Toolbar to do so.