Tuto WEBDEV 25

Part 3: Intranet site with data 113 Modifying products via a "Product form" page in Session mode Now that the list of products is displayed, you may want to modify a product. We are now going to create a page used to display the product details in order to modify them. Creating the page ▶ To create a page used to display the product details: 1. Create a new blank page. • Click among the quick access buttons. • The element creation window appears: click "Page" then "Page". • The wizard for page creation starts. • In the "Based on a project template" area, choose "PAGETPL_Menu" and validate the wizard. 2.  The window for saving the page is displayed. Type the page title: "Product form". The page name "PAGE_Product_form" is automatically proposed. 3. Validate. What should this page do? This page is intended to modify the characteristics of the product currently selected in the Looper control. This type of page is called "Form" because it corresponds to a descriptive form of the requested element. In our case, this page will be used to display the content of different items found in the "Product" data file. First of all, we are going to indicate to the page the product that will be displayed. To do so, all you have to do is declare a parameter in the page. ▶ To declare a parameter in the page: 1. Press F2. The code editor displays the different page events. 2. Write the following WLanguage code in the "Global declarations" event: PROCEDURE MyPage(gnProductID is 8-byte int) 3.  Let’s take a look at this WLanguage code: • The PROCEDURE keyword in the "Global declarations" event is used to associate a procedure to the opening of the page. • The procedure is named "MyPage". At run time, this keyword will be automatically replaced by the name of current page. • The procedure expects the gnProductID variable (that is an 8-byte integer) in parameter. This variable corresponds to the product identifier that will be displayed in the page. The type of this variable is identical to the type of corresponding ProductID item described in the Product data file. 4. Close the code editor.

RkJQdWJsaXNoZXIy NDQ0OA==