Tuto WINDEV 25

Part 2: The WLanguage basics 71 7. Write the following code in the "Click" WLanguage event: // Moves the image to the left LOOP IMG_NoName1..X-- IF IMG_NoName1..X <= 0 THEN BREAK END This code is used tomodify theX coordinateof Image control ( ..X ). At each turn, a condition is checked. If this condition is true, the program exits from the loop. In our case, the condition is as follows: • the position of the Image control is 0, • the position of the Image control is less than 0 (used to manage the case where the user presses the button several times). Remark When typing this code, the LOOP statement may be underlined by a green line and a warning may appear in the pane of compilation errors. This warning reminds you that an exit statement must be found in the loop code to avoid an infinite loop. 8. Close the code window (click X at the top right corner of code editor). Window test ▶ Let’s now run the window test: 1. Click among the quick access buttons (or press F9). 2.  The created window is started in execution. 3. Click the different buttons. 4. Close the test window.

RkJQdWJsaXNoZXIy NDQ0OA==