Tuto WINDEV 25
Part 4: Full application with data 213 ▶ We are now going to define the option caption and write its WLanguage code. 1. Select "Menu option". 2. Press the Space key on the keyboard: the caption becomes editable. Type the new caption ("Print the order form") and validate. 3. Display the WLanguage events associated with the option: • Select the option. • Display the popup menu (right mouse click) and select "Code". 4. Write the following WLanguage code: // Report viewer iDestination(iViewer) // Initializes the report query iInitReportQuery(RPT_Order_form, ... TABLE_QRY_FindOrders.COL_OrdersID) // Starts printing the report iPrintReport(RPT_Order_form) In this code: • iDestination is used to specify that the report will be printed in the report viewer. • iInitReportQuery is used to specify the parameters expected by the query associated with the report. In our case, the query expects the order number in parameter. This order number is found in the COL_OrdersID column of the TABLE_QRY_FindOrders Table control for the current row. • iPrintReport is used to print the specified report (the RPT_Order_form report in our case). 5. Close the code window and the window containing the popup menu. 6. Save the "WIN_Menu" window. Associating the popup menu with the Table control ▶ Last step: we are going to link the popup menu to the Table control. 1. In the "WIN_Menu" window, display the "Finding orders" tab. 2. Select the Table control and display its description ("Table description" from the popup menu of control). 3. In the "UI" tab, expand the "Popup menu" combo box. 4. Check "Add a popup menu", select the "MENU_Order" menu and select "At the beginning" to specify that the menu is placed before the system menu. 5. Click inside the window to validate the popup menu. 6. Validate.
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==