Tuto WINDEV 25
Part 2: The WLanguage basics 69 4. Click the button on the right of "Image" control. Select "Catalog" from the popup menu that is displayed. The window of image catalog is displayed. 5. Type "Animal" in the search area. Click the magnifier to start the search. 6. Select and validate ("OK"). 7. A window used to configure the image is displayed. Keep the default options and validate. 8. The image is displayed in the Image control. Validate the control description window. 9. Save the window (press Ctrl + S or click among the quick access buttons). ▶ We are now going to create a Button control to allow the image to move by 300 pixels to the right in the window. To do so, we will be using the FOR statement of WLanguage. 1. On the "Creation" pane, in the "Usual controls" group, click . 2. Click the location where the control will be created (below the Image control for example). 3. Click the control that was just created. The text displayed in the control becomes editable. Type the caption: "FOR statement". 4. Press Enter to validate the input. 5. Adapt the control size. 6. Display the events associated with the control (F2). 7. Write the following code in the "Click" WLanguage event: // Moves the image horizontally by 300 pixels FOR i = 1 TO 300 IMG_NoName1..X++ END This code is used to modify the X coordinate of Image control ( ..X ) in a loop from 1 to 300. At each loop turn, the X coordinate is increased by one pixel.
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==