Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

Required plugins for this example: MBS MacBase Plugin, MBS MacFrameworks Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacFrameworks/GeoCoder
This example is the version from Mon, 29th Jul 2012.
Project "GeoCoder.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control TextField1 Inherits TextField
ControlInstance TextField1 Inherits TextField
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() if g.isGeocoding then g.cancelGeocode end if g.geocodeAddressString TextField1.text, c End EventHandler
End Control
EventHandler Sub Close() if c<>nil then c.l = nil end if End EventHandler
EventHandler Sub Open() if CLGeocoderMBS.Available = false then MsgBox "Please upgrade to Mac OS X 10.8." quit end if g = new CLGeocoderMBS c = new MyCLGeocodeCompletionHandlerMBS c.l = list End EventHandler
Property c As MyCLGeocodeCompletionHandlerMBS
Property g As CLGeocoderMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MyCLGeocodeCompletionHandlerMBS Inherits CLGeocodeCompletionHandlerMBS
EventHandler Sub Completed(geocoder as CLGeocoderMBS, placemarks() as CLPlacemarkMBS, error as NSErrorMBS) if l = nil then Return l.DeleteAllRows if error<>Nil then l.AddRow "Error: "+error.localizedDescription end if for each p as CLPlacemarkMBS in placemarks l.AddRow "Placemark found:" Add " name: ", p.name Add " locality: ", p.locality Add " subLocality: ", p.subLocality Add " thoroughfare: ", p.thoroughfare Add " subThoroughfare: ", p.subThoroughfare for each a as string in p.areasOfInterest Add " areasOfInterest: ", a next Add " inlandWater: ", p.inlandWater Add " ocean: ", p.ocean Add " postalCode: ", p.postalCode Add " administrativeArea: ", p.administrativeArea Add " subAdministrativeArea: ", p.subAdministrativeArea Add " ISOcountryCode: ", p.ISOcountryCode Add " country: ", p.country dim cl as CLLocationMBS = p.location if cl<>nil then add " latitude: ",cstr(cl.latitude) add " longitude: ",cstr(cl.longitude) end if next End EventHandler
Sub Add(label as string, text as string) if text<>"" then l.AddRow label+text end if End Sub
Property l As Listbox
End Class
End Project

Feedback, Comments & Corrections

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

MBS FileMaker blog