Platforms to show: All Mac Windows Linux Cross-Platform

/Bluetooth/Mac Bluetooth/Mac Bluetooth Dialogs


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

Last modified Fri, 18th Dec 2025.

You find this example project in your MBS Xojo Plugin download as a Xojo project file within the examples folder: /Bluetooth/Mac Bluetooth/Mac Bluetooth Dialogs

Download this example: Mac Bluetooth Dialogs.zip

Project "Mac Bluetooth Dialogs.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MainWindow Inherits Window
Control ChooseDeviceButton Inherits PushButton
ControlInstance ChooseDeviceButton Inherits PushButton
EventHandler Sub Action() DeviceSelectorController.beginSheetModalForWindow(self) End EventHandler
End Control
Control ChooseServiceButton Inherits PushButton
ControlInstance ChooseServiceButton Inherits PushButton
EventHandler Sub Action() ServiceBrowserController.beginSheetModalForWindow(self) End EventHandler
End Control
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open() DeviceSelectorController = new IOBluetoothDeviceSelectorController ServiceBrowserController = new IOBluetoothServiceBrowserController(IOBluetoothServiceBrowserController.kOptionsNone) DeviceSelectorController.list = list ServiceBrowserController.list = list DeviceSelectorController.Title = "Device Selector" ServiceBrowserController.Title = "Service Browser" End EventHandler
Property DeviceSelectorController As IOBluetoothDeviceSelectorController
Property ServiceBrowserController As IOBluetoothServiceBrowserController
End Class
Class IOBluetoothDeviceSelectorController Inherits IOBluetoothDeviceSelectorControllerMBS
EventHandler Sub SheetDone(returnCode as Integer, tag as Variant) select case returnCode case me.kIOBluetoothUISuccess List.AddRow "Success" case me.kIOBluetoothUIUserCanceledErr List.AddRow "Cancelled" end Select dim devices() as IOBluetoothDeviceMBS = me.Results for each device as IOBluetoothDeviceMBS in devices List.AddRow device.nameOrAddress next End EventHandler
Property List As Listbox
End Class
Class IOBluetoothServiceBrowserController Inherits IOBluetoothServiceBrowserControllerMBS
EventHandler Sub SheetDone(returnCode as Integer, tag as Variant) select case returnCode case me.kIOBluetoothUISuccess List.AddRow "Success" case me.kIOBluetoothUIUserCanceledErr List.AddRow "Cancelled" end Select dim serviceRecords() as IOBluetoothSDPServiceRecordMBS = me.Results for each serviceRecord as IOBluetoothSDPServiceRecordMBS in serviceRecords List.AddRow serviceRecord.ServiceName 'dim d as Dictionary = serviceRecord.Properties 'Break next End EventHandler
Property List As Listbox
End Class
Sign
End Sign
ExternalFile info
End ExternalFile
End Project

See also:

Download this example: Mac Bluetooth Dialogs.zip

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


The biggest plugin in space...