You can use the Extract Function to clean up your lengthy
or overly-complicated functions.
About this task
When you extract a function, note that the Extract
Function is disabled if the code fragment that you select
is in an interface, record, external type, form, or form group parts
that cannot contain function declaration.
To extract a function,
complete the following steps:
Procedure
- In the EGL editor, select a set of statements from a nested
function or a top-level function and then right-click.
- From the pop-up menu, click .
The
Extract
EGL Function window is displayed. If an error message is
displayed, stating that your code selection is not complete, click
Expand
Selection To to extend your selection to a valid fragment.
See
Expanding your selection for information about how to expand
your code selection.
- In the Function name field, enter
a function name that complies with naming conventions of EGL and is
unique in the current scope.
The function parameters are
listed in the table and they cannot be changed.
- To preview the changes, click Preview.
The preview page displays the changes that will be made. Click OK to
extract the function.
Results
A new function that contains the statements you selected is
created. Your selection is replaced with a reference to the new function.