Example: /MacFrameworks/CoreLocation/Locate Address Web

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/MacFrameworks/CoreLocation/Locate Address Web


Required plugins for this example: MBS MacFrameworks Plugin, MBS Main Plugin, MBS MacBase Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/CoreLocation/Locate Address Web

This example is the version from Mon, 6th Nov 2022.

Project "Locate Address Web.xojo_binary_project"
Class App Inherits WebApplication
EventHandler Sub Opening(args() as String) t = new CoreLocationEventsTimer End EventHandler
Property t As CoreLocationEventsTimer
End Class
Class MyCLGeocodeCompletionHandlerMBS Inherits CLGeocodeCompletionHandlerMBS
EventHandler Sub Completed(geocoder as CLGeocoderMBS, placemarks() as CLPlacemarkMBS, error as NSErrorMBS, tag as variant) dim w as new WebSessionContext(targetSession) dim l as WebListBox = List l.RemoveAllRows if error<>nil then l.AddRow "Error", error.LocalizedDescription end if l.AddRow "Count of placemarks", str(UBound(placemarks)+1) for each p as CLPlacemarkMBS in placemarks l.AddRow "name", p.name l.AddRow "locality", p.locality l.AddRow "subLocality", p.subLocality l.AddRow "thoroughfare", p.thoroughfare l.AddRow "subThoroughfare", p.subThoroughfare l.AddRow "administrativeArea", p.administrativeArea l.AddRow "subAdministrativeArea", p.subAdministrativeArea l.AddRow "postalCode", p.postalCode l.AddRow "country", p.country dim ad as Dictionary = p.addressDictionary for each key as Variant in ad.keys dim value as Variant = ad.Value(key) if value.IsArray then // convert array of variants with strings to string array for join dim v() as Variant = value dim s() as string for each k as Variant in v s.Append k.StringValue next value = Join(s, ", ") end if l.AddRow "Address "+key, value next l.AddRow "areasOfInterest", join(p.areasOfInterest, ", ") l.AddRow "ocean", p.ocean l.AddRow "inlandWater", p.inlandWater l.AddRow "ISOcountryCode", p.ISOcountryCode dim r as CLRegionMBS = p.region if r<>nil then l.AddRow "region latitude", str(r.latitude) l.AddRow "region longitude", str(r.longitude) l.AddRow "region radius", str(r.radius) end if dim cl as CLLocationMBS = p.location l.AddRow "Location Latitude", str(cl.Latitude) l.AddRow "Location Longitude", str(cl.Longitude) next Finally // clearnup selfRef = nil list = nil targetSession = nil End EventHandler
Property list As WebListBox
Property selfRef As MyCLGeocodeCompletionHandlerMBS
Property targetSession As WebSession
End Class
Class CoreLocationEventsTimer Inherits Timer
EventHandler Sub Action() // for web app, check every few Milliseconds if something happend CLLocationManagerMBS.CheckEvents End EventHandler
Sub Constructor() mode = 2 Period = 500 End Sub
End Class
End Project

See also:

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


💬 Ask a question or report a problem