Tuto WEBDEV 25

Part 13: The WLanguage basics 459 Overview A procedure is used to associate an identifier with a code section in order to re-use it. In this lesson, we are going to present the different types of procedures available in WLanguage, their creation mode, how to call them, pass parameters and retrieve a result. Types of procedures Three types of procedures are available: • Global procedure : can be used in all project the events and processes of the project (declared in a set of procedures). • Local procedure in a Window, Page or Mobile Window: can be used in all the events and processes that depend on the object in which this procedure was declared. • Internal procedure in a process or event: can only be used in the process or event where it was declared. Remark Scope of procedures The procedures comply with the scope rules presented for the variables (see "The scope of variables"). Creating and calling a procedure Global procedure To create a global procedure , you must: 1. Create (if necessary) a set of procedures (via the "Project explorer" pane, "Procedures" folder). Give a name to the set of procedures. 2. Create a global procedure in the set of procedures (via the "Project explorer" pane, "Procedures, Set name" folder). Give a name to the procedure. 3.  Type the code of global procedure. The procedure code has the following format: PROCEDURE <Name of global procedure>() Local procedure To create a local procedure , you must: 1. Select the element associated with the procedure (window, page, etc.). 2. Create a local procedure (via the "Project explorer" pane, expand the element name, "Local procedures" folder). 3. Give a name to the procedure. 4.  Type the code of local procedure. The procedure code has the following format: PROCEDURE <Name of local procedure>()

RkJQdWJsaXNoZXIy NDQ0OA==