Dialog: “Add Method” Permalink

Function: Defines a method below the selected POU when the dialog is closed.

Call: “Project  Add Object  Method”; context menu

Requirement: A program (‎PRG‎) or a function block (‎FUNCTION_BLOCK‎) is selected in the “POUs” view or the “Devices” view.

The interface of a method inserted below a basic function block is copied when a method with the same name is inserted below a derived function block.

“Name”

Example: ‎meth_DoIt‎.

The standard methods ‎FB_Init‎ and ‎FB_Exit‎ are offered in a list box if they are not already inserted below the POU. If it is a derived function block, then the list box also offers all of the methods of the basic function block.

“Return type”

Default data type or structured data type of return value

Example: ‎BOOL‎

“Implementation language”

Example: “Structured Text (ST)”

“Access specifier”

Controls access to data.

  • “PUBLIC” or not specified: Access is not restricted.

  • “PRIVATE”: Access is restricted to the program, function block, or GVL.

    The object is marked as ‎(private)‎ in the POU or device view. The declaration contains the keyword ‎PRIVATE‎.

  • “PROTECTED”: Access is restricted to the program, function block, or GVL with its derivations. The declaration contains the keyword ‎PROTECTED‎.

    The object is marked as ‎(protected)‎ in the POU or device view.

  • “INTERNAL”: Access to the method is restricted to the namespace (library).

    The object is marked as ‎(internal)‎ in the POU or device view. The declaration contains the keyword ‎INTERNAL‎.

“Abstract”

_cds_icon_option_activated_copy.png: Identifies that the method does not have an implementation and the implementation is provided by the derived FB.

“Add”

Adds a new method to the selected object.