Tuto WINDEV Mobile 25

Part 5: Android and iOS: Developing an application 129 4. Click "Disable the automatic scrollbar". The Map control appears in the window editor. 5. Open the "Map" control description window (double-click the control for example). 6.  In the control description window, specify the control name ("MAP_STORE") and validate. 7. Save the modifications by clicking among the quick access buttons. Displaying stores on the map Principle We are now going to add the code used to display all stores of the "Store" data file on a map. To do so, we will browse the "Store" data file with a FOR EACH loop. Then, the Marker variables will be used. A Marker variable is used to define a marker that will be displayed on a map. A marker contains various information. We will be using the following information: • Name, • Latitude, • Longitude. MapAddMarker is used to add a marker on the Map control. Then, simply adjust the zoom level to see all markers in the Map control. If the zoom is not properly adjusted, some markers may not be visible or may overlap on the control. Implementation ▶ To enter the WLanguage code to display the stores: 1. Right-click outside the window. Select "Code" from the popup menu that is displayed. The different WLanguage events associated with the window are displayed. 2. Write the following WLanguage code in the event "Global declarations of...". // Global variables gMarker is Marker // Load the stores FOR EACH Store // Marker coordinates gMarker.Position.Latitude = Store.Latitude gMarker.Position.Longitude = Store.Longitude // Marker name gMarker.Name = Store.Name // Add the marker MapAddMarker(MAP_STORE,gMarker) END // Best zoom to view all markers on the map MAP_STORE..Zoom = zoomAdaptSize 3. Save the modifications by clicking among the quick access buttons. 4. Close the code window (click X at the top right corner of code editor). ▶ Run the test of "WIN_Map_of_stores" window in the simulator ( among the quick access buttons). Then, close the simulator.

RkJQdWJsaXNoZXIy NDQ0OA==