Article Preview
Buy Now
COLUMN
Find Yourself
How to determine the location of devices with MBS under Windows and Mac
Issue: 22.2 (March/April 2024)
Author: Stefanie Juchmes-Simonis
Author Bio: Stefanie studied computer science at the university in Bonn. She came in touch with Xojo due to the work of her brother-in-law and got a junior developer position in early 2019 at Monkeybread Software.
Article Description: No description available.
Article Length (in bytes): 10,226
Starting Page Number: 66
Article Number: 22008
Resource File(s):
project-22008.zip Updated: 2024-02-29 23:35:06
Related Link(s): None
Excerpt of article text...
In this article I would like to show you how you can determine the position of your device for Mac and Windows.
Let's start with Windows first. For this purpose, we have the Windows Location topic in the plugin. To determine the position, we need an object based on the
WindowsLocationManagerMBS
class. For this reason, we create a class in our project that has theWindowsLocationManagerMBS
class as a subclass. We start by creating an instance of this class in theLM
property. Now we can call theStartEvents
method. This method tells the events that they can start working. In this way, we can also work with theLocationChanged
event later.Now we have to make a request for access. We do this with the
RequestPermissions
method and specify the window in the parameter. In our case, we reference the window in which this method is also used. We can then use theReportStatus
property to query the current status and react to it. There are a total of five different statuses that can be returned. We would like to go through these possible statuses in aSelect Case
statement. In most cases, a text should be output that shows us what the status is to alert us to possible problems. The status we want isRunning
. If this status is the result, no text should be output. Instead we wait for theLocationChanged
event to fire and provide us with the data for our location.This is what the code looks like that we have written behind a button to call up the location.
LM = New MyLocationManager
...End of Excerpt. Please purchase the magazine to read the full article.