Tuto WINDEV 25

430 Part 7: Advanced programming Declaring and handling the objects In the window WLanguage events, an object is declared at the same time as the other variables: // Global declarations of WIN_OOP PROCEDURE WIN_OOP() // Savanna object gclTheSavanna is cSavanna(IMG_Landscape..FullName) To refer to a member of "cSavanna" object, use the following syntax <ObjectName>.<member name> ▶ In our example, the object is handled: • In the "Initializing" event of the window, to build the savanna. // Draws the savanna gclTheSavanna.DrawSavanna() • When creating an animal, to position the animal in the savanna. // Declares a new elephant clElephant is cElephant("Elephant "+ GetIdentifier(), 13) // Adds the elephant into the savanna (this action refreshes the drawing) IF gclTheSavanna.AddAnimal(clElephant) THEN // End message ToastDisplay("Animal added", toastShort, vaMiddle, haCenter) END We won’t go into details about OOP in this tutorial.

RkJQdWJsaXNoZXIy NDQ0OA==