Tuto WINDEV 25

Part 2: The WLanguage basics 59 Remarks : • If the code line "CASE 1:..." is run, the other code lines corresponding to the possible values are not run. • Several values can be grouped in the same case. The different values are separated by a comma. For example: Sub is int = 2 SWITCH Sub CASE 1,2: Info("Case 1 or 2") CASE 3: Info("Case 3") OTHER CASE: Info("Other case") END • Several code lines can be run during the process corresponding to an expression value. In this case, the following syntax must be used: SWITCH <Expression> CASE Value 1: Process 1 - Code line 1... Process 1 - Code line 2... CASE Value N: Process N - Code line 1... Process N - Code line 2... OTHER CASE Process ... END Practical example: Using the IF and SWITCH statements To use the conditional statements, we are going to create the following window: Two operations can be performed: • If the user clicks the check box, the "Close" button is displayed. • If the user clicks the "Test" button, the box checked in the check box is displayed. Project used To handle the different concepts of this lesson, we are going to create different windows. These windows will be created in the "WD My first windows" project. ▶ Open the "WD My First Windows" project if necessary. To do so, in WINDEV’s home page (Ctrl + <), click "Tutorial" and select "My first windows (Exercise)".

RkJQdWJsaXNoZXIy NDQ0OA==