Using Selection Layer (Navigation to select a location)
In Maps (Grid with Control Type property = Maps) it is possible to enable a navigation mode that allows you to select a location (GeoPoint). In this navigation, there is an icon in the center that remains fixed and you can move the map to select a position (and get its coordinates). This is handled with the Selection Layer property.
Controls: Grid (Control Type: Maps)
Generators: Android, Apple
When the Selection Layer property = True, it will be possible to move on the map at runtime, having a fixed icon in the center that obtains the position and triggers an event.
The navigation is similar to what is achieved using the PickLocation Method.
The icon can be configured using the Location Selection Target Image property. Also, by setting the Selection Layer property = True, the Selection Target Image Class property is enabled to associate a class to that image (by default there is a class created under the name: SDMapPinImage).
In addition, by setting the Selection Layer property = True, two events are available: ControlValueChanging and ControlValueChanged.
ControlValueChanging(GeoPoint) event
This event is triggered while the map is moving. For example:
Event Grid1.ControlValueChanging(&geoPoint)
composite
msg(&geoPoint.Tostring())
endcomposite
Endevent
ControlValueChanged(GeoPoint) event
This event is triggered when you stop moving the map. For example:
Event Grid1.ControlValueChanged(&geoPoint)
composite
msg(&geoPoint.Tostring())
endcomposite
Endevent
You get the position to which the map was moved in the GeoPoint type parameter.
The code in the example shows the string corresponding to the position to which the map was moved (i.e.: POINT(Long Lat)).
The event ControlValueChanged is overloaded with values, therefore the parameter could be Character type (instead of GeoPoint).
Layers in Maps