Download HDevelop User`s Manual

Transcript
6.4.3 Creating and Editing Procedures
109
Move Up, Move Down Using these buttons you can alter the order of the parameters. Select a parameter
by clicking its text field and use the buttons to change its position.
OK Activating the button OK on bottom of the dialog either creates a new procedure or commits the
changes made in the procedure interface, depending on whether the interface dialog was invoked
in order to create a new procedure or to modify the interface of an existing procedure. In the
latter case not only the interface itself might be changed but also the procedure’s program body
and variable lists, as new variables might have been added or existing variables might have been
removed or renamed.
If you are editing an existing procedure interface, the checkbox Adapt program becomes available. If it is checked, all calls to the procedure in the current program are checked for consistency
and updated if necessary. Note that if new parameters are added to an existing procedure interface, the corresponding procedure calls are modified by adding new variables as input parameters,
which most likely will not be initialized at the time of the procedure call.
If you change the interface of an external procedure, be aware of the fact that other programs
containing it do not update the procedure calls. When loading these programs, the procedure calls
are disabled. If the changes were applied to a procedure that is called from inside a protected
external procedure, that procedure call is not even updated in the current program.
Cancel This button dismisses the dialog. Any changes to the interface of the edited procedure are lost
(with the exception of the editing status, see section “Edit Status of External Procedures” on page
111).
6.4.3.2
Creating Procedures
By default, a local procedure is created. If you want to create an external procedure instead, you have to
disable the check box Local and optionally specify chapter and subchapter. Additionally, you can select
the path the procedure is stored in, which by default is the first path specified in the preferences (see
section “External Procedures” on page 66). Further, section “Edit Status of External Procedures”
on page 111 shows how to protect an external procedure by a password so that only authorized persons
can view and modify it.
When creating a new procedure from selected program lines, HDevelop automatically determines suitable interface parameters for the procedure from the usage of the variables in the selected code. The
following different options can be selected in the combo box Selection Scheme to determine the procedure parameters:
Only In Only Out Variables that are exclusively input and output variables become input and output
procedure parameters, respectively.
GUI Reference
Depending on the corresponding procedure options and a possible selection of lines in the program
window, there are different ways on how a procedure can be created. When clicking Menu Procedures
. Create New Procedure, the program lines marked in the program window are copied and inserted
in the program body of the new procedure. This is illustrated in figure 6.34. If the last selected program
line is not a return operator, a return call is added at the end of the procedure body. If no lines are
selected in the program window, the newly created procedure body contains only the return operator.