Tuto WINDEV 25
188 Part 4: Full application with data ▶ To create a Combo Box control: 1. On the "Creation" pane, in the "Usual controls" group, click "Combo Box". 2. Click the location where the control must be created in the window (beside the Radio Button control that was just created for example). 3. The wizard for creating the Combo Box control starts. 4. Select "Display the data found in a file or in an existing query" and go to the next step. 5. Select the "PaymentMode" data file and go to the next step. 6. The item that will be displayed in the Combo Box control is "Caption". Uncheck "PaymentModeID" and check "Caption". Go to the next step. 7. Select the sort item: "Caption". Go to the next step. 8. Select the return value: "PaymentModeID". This return value is very important because it will be passed in parameter to the query. Go to the next step. 9. Keep the default options in the different wizard steps and validate the creation of Combo Box control. 10. The Combo Box control is automatically created in the window. ▶ We are going to modify some characteristics of Combo Box control: 1. Select the Combo Box control and display the description window of control ("Description" from the popup menu). 2. In the "General" tab, modify the control caption: replace "PaymentMode combobox" by "Payment mode". 3. In the "Content" tab, specify the initial value displayed by the Combo Box control ("Initial value" at the bottom of description window). In our case, type "1". This value corresponds to a payment in cash. 4. Validate the control description window. ▶ Change the control style: to occupy less space, we are going to select a style that displays the caption above the control. 1. Select the Combo Box control. 2. In the popup menu (right mouse click), select "Choose a style". 3. In the window that is displayed, select the "COMBO_Internal" style and validate. 4. Reduce the control size. ▶ We are now going to use the value selected in the Combo Box control to pass it to the query as parameter: 1. Display the WLanguage events associated with the Table control: • Select the Table control. • Display the popup menu (right mouse click) and select "Code". 2. In the "Initializing" event of the Table control, replace the line: MySource.ParamPaymentModeID = "1" by the code: MySource.ParamPaymentModeID = COMBO_PaymentMode
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==