Tuto WINDEV Mobile 25
120 Part 5: Android and iOS: Developing an application • Right-click the option. • Select "Code" from the popup menu that is displayed. • Write the following WLanguage code in the event "Selecting the menu": HReset(Product) OpenMobileWindow(WIN_Product_form) HReset initializes the item variables in the "Product" data file with the default values to manage a new record. 7. Save the modifications by clicking among the quick access buttons. 8. Close the code window (click X at the top right corner of code editor). ▶ Let’s now check the management of record addition into the window of product form. 1. Open the "WIN_Product_form" window in the editor: click the corresponding button in the open documents bar. 2. Display the code of validation option in the Action Bar: • Select the Action Bar. • Click on "OK". • A drop-down menu with the "Done" option is displayed. • Select "Code" from the popup menu of "Done" option (right mouse click). • The WLanguage code of the "Click" event does not change: ScreenToFile() HSave(Product) Close() Let’s look at this code again: • By default, HSave is equivalent to HModify (current record modified in the data file). • If Hreset has been previously called (as is the case when adding a new product), HSave adds a new record in the data file (equivalent to HAdd ). 3. Close the code window (click X at the top right corner of code editor). ▶ Open "WIN_List_of_products" in the window editor and test it in the simulator ( among the quick access buttons). • Click the "+" button found in the Action Bar. • Type a new product. • Validate. The new product is displayed in the list of products. • Close the simulator. Remark If your project is using several platforms, a GO must be run for each platform. The differences regarding the display and the operating modes will appear in the simulator.
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==