Tuto WINDEV Mobile 25
Part 6: Windows Mobile application 201 ▶ We will now write the WLanguage code associated with the "Validate" Button control. 1. Right-click on the control and select the "Code" option from the popup menu. 2. Write the following code in the "Click" event: ScreenToFile() HModify(Product) Close() Let’s study this code: • ScreenToFile is used to initialize the items with the values of linked controls, for the current record. • HModify is used to update the file data for the current record. • Close is used to close the form and to go back to the "WIN_List_of_products" window. 3. Save the modifications by clicking among the quick access buttons. 4. Close the code window (click X at the top right corner of code editor). ▶ Display the "WIN_List_of_products" window in the window editor and run its test in the simulator ( among the quick access buttons). • In the list of products, click one of the products with the mouse: for example, the "Polo Hibbicus Blue" product at a price of 25.90 Dollars. • Click "Modify the element". • The detailed window of product is displayed. Modify the price of 25.90 Dollars and type 19.90 Dollars, then click the "Validate" button. • When going back to the list of products, you will notice that the price was updated for this product. ▶ Close the simulator. The WINDEV Mobile editor is displayed. Creating a new product The principle for creating a product is as follows: • In the window for the list of products, we are going to add a "New product" button that will be used to open the "Product form" window. • Then, we will modify the code of "Product form" window to manage the addition into the Product data file. ▶ First of all, display (if necessary) the "WIN_List_of_products" window in the editor: click the corresponding button in the button bar. ▶ To create a new Button control: 1. On the "Creation" pane, in the "Usual controls" group, click : the shape of the control appears under the mouse pointer. Then click in the window to create the control (for example next to the Button control "Modify the element"). 2. Select the control and press Enter. The control caption becomes editable. Type "New product" and press Enter on the keyboard.
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==