Platforms to show: All Mac Windows Linux Cross-Platform

/MacFrameworks/CoreLocation/CoreLocation to find computer location


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/CoreLocation to find computer location

This example is the version from Sun, 17th Mar 2012.

Project "CoreLocation to find computer location.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
EventHandler Sub Close() LocationManager.stopUpdatingLocation End EventHandler
EventHandler Sub Open() if not MyLocationManager.locationServicesAvailable then MsgBox "Location Services are not available." end if if not MyLocationManager.locationServicesEnabled then MsgBox "Location Services are not enabled." end if LocationManager=new MyLocationManager LocationManager.desiredAccuracy=CLLocationMBS.kCLLocationAccuracyBest LocationManager.startUpdatingLocation End EventHandler
Property LocationManager As MyLocationManager
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyLocationManager Inherits CLLocationManagerMBS
EventHandler Sub didFailWithError(error as NSErrorMBS) dim l as listbox = MainWindow.List l.DeleteAllRows l.AddRow "Error:" l.AddRow error.localizedDescription l.AddRow error.localizedFailureReason l.AddRow error.localizedRecoverySuggestion End EventHandler
EventHandler Sub didUpdate(newLocation as CLLocationMBS, oldLocation as CLLocationMBS) dim l as listbox = MainWindow.List l.DeleteAllRows l.AddRow "new Location:" l.AddRow newLocation.description l.AddRow "Latitude: "+str(newLocation.latitude) l.AddRow "Longitude: "+str(newLocation.longitude) l.AddRow "Altitude: "+str(newLocation.altitude) l.AddRow "Course: "+str(newLocation.course) l.AddRow "HorizontalAccuracy: "+str(newLocation.horizontalAccuracy) l.AddRow "VerticalAccuracy: "+str(newLocation.verticalAccuracy) l.AddRow "Speed: "+str(newLocation.speed) l.AddRow "Timestamp: "+newLocation.timestamp.LongDate+" "+newLocation.timestamp.LongTime if oldLocation<>nil then l.AddRow "" l.AddRow "old Location: " l.AddRow oldLocation.description l.AddRow "Latitude: "+str(oldLocation.latitude) l.AddRow "Longitude: "+str(oldLocation.longitude) l.AddRow "Altitude: "+str(oldLocation.altitude) l.AddRow "Course: "+str(oldLocation.course) l.AddRow "HorizontalAccuracy: "+str(oldLocation.horizontalAccuracy) l.AddRow "VerticalAccuracy: "+str(oldLocation.verticalAccuracy) l.AddRow "Speed: "+str(oldLocation.speed) l.AddRow "Timestamp: "+oldLocation.timestamp.LongDate+" "+oldLocation.timestamp.LongTime end if End EventHandler
End Class
End Project

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


The biggest plugin in space...