In this article I want to introduce you the new functionalities from the MBS Xojo Plugins in version 22.2.
In the Regular Expressions topic there are huge changes. So far we have had the class RegExMBS. This is now deprecated and is no longer being developed, but remains in the plugin and can be used. We now provide the more modern classes:
With the new ZStdMBS class from the topic Compression we have now a class for the ZStandard compression. You can compress and decompress strings and memory blocks with a ZStandard algorithm.
Dim InputText As String = "Hello World. Hello World. Hello World. Hello World. Just a test! Hello World. Testing 😝" Dim Compressed As String = ZStdMBS.Compress(InputText) Dim OutputText As String = ZStdMBS.Decompress(Compressed).DefineEncoding(encodings.UTF8)ZStandard is characterized by being efficient and leak-free.
In the topic USB we have two new classes. With the class LibUSBTransferMBS we have a class for the asynchronous USB transfer. The user populates this class and then submits it in order to request a transfer. After the transfer has completed, the library populates the transfer with the results and passes it back to the user. In connection with this we have the new class LibUSBISOPacketDescriptorMBS. This class describes an isochronous packet descriptor. Isochronous transfers are used for real-time transfer of e.g. audio and video files.
From the SQL section in the SQLite3MBS class we have the new ConnectionHandle property, which returns the current connection reference for the database. For the classes SQLConnectionMBS and SQLDatabaseMBS we have in each one a method SQLiteConnectionHandle that gives us also this information.
The new method Tags from the class WordFileMBS returns a list of all tags of a Word file or of a certain area of the document. If we want to read the tags in a specific section we can define this section with OpenMarker and CloseMarker.
New functionalities for Mac
The MBS Xojo Plugins in version 22.2 offers some more new features for Mac users
In the AVCaptureVideoPreviewLayerMBS class, we have four new methods that are all about points of interest in videos. The captureDevicePointOfInterestForPoint method converts a point in layer coordinates to a point of interest in the coordinate space of the capture device that provides the input for the layer. Matching this, we have the reverse method pointForCaptureDevicePointOfInterest. We have also developed similar methods for the metadata. The rectForMetadataOutputRectOfInterest method converts a rectangle of interest in the coordinate space of an AVCaptureMetadataOutput whose capture device provides input to the layer to a rectangle in layer coordinates. The reverse method is rectForMetadataOutputRectOfInterest. In the AVCaptureDeviceFormatMBS class we also have a few new properties that affect the zoom in the video. So we can now query the zoomfactor of the video, what the maximum zoomfactor is and we can query which minimum and maximum zoomfactor is possible. Furthermore we can query with isRampingVideoZoom whether a zoom transition is in progress.
We have two new methods from the Cocoa area. With the method initWithHTML from the class NSAttributedStringMBS we can initiate a string using an HTML. This way we can very elegantly extract the body text from an HTML. Such a method already exists in this class, but with the new method we can additionally specify options like the encoding in the parameters. This is especially important for texts with special characters. As we can see in the following example:
Dim theBody As String = "<html><body>Test äöü😊</body></html>" Dim documentAttributes As Dictionary Dim documentOptions As New Dictionary // define the text encoding Const NSUTF8StringEncoding = 4 documentOptions.Value(NSAttributedStringMBS.NSCharacterEncodingDocumentOption) = NSUTF8StringEncoding Dim BodyAttributed As New NSAttributedStringMBS If BodyAttributed.initWithHTML(theBody, documentOptions, documentAttributes) Then MessageBox BodyAttributed.Text Else Break // failed? End IfThe special characters are displayed without problems thanks to the given encoding, as you can see here:
Another new method from this section comes from the NSViewMBS class called Screenshot and as the name suggests it gives us a picture of the view. It works similar to the ScreenshotWindowMBS class, but only for the view you are interested in, e.g. a map.
With the topic Sparkle, we have been making available for years a framework for Mac OS X to enable application to automatically update themselves. In this Plugin update we have two new methods for the SUAppcastItemMBS class. We have a new constructor for the class in which you can additionally specify the relativeToAppcastURL parameter. Furthermore we can return an empty appcast item with the new method emptyAppcastItem. Additionally we have some new properties for this class. For example we can get the maximum or minimum OS version, we can query the channel the update item and much more.
New functionalities for Windows
Last but not least I want to introduce the new functionalities for Windows users.
We have added some new class for working with Bluetooth Low Energy devices. Objects of the new WindowsBluetoothLEDeviceMBS represent such devices and make it possible to work with them. A property of this class contains an object of a class that is also new. The Appearance property of Typ WindowsBluetoothLEAppearanceMBS. This new class provides functionality to determine the Bluetooth Low Energy (LE) Appearance information for a device, such as the Heart Rate Appearance Category Code or the Media Player Appearance Category Code.
The WindowsBluetoothLEAdvertisementMBS class is used to represent an advertisement received from the system, an advertisement pattern to filter for, or an advertisement payload to publish. When generated by the system to represent an ad received, certain properties are automatically populated.
Appropriately, we have the WindowsBluetoothLEAdvertisementWatcherMBS classes that receives these objects and the WindowsBluetoothLEAdvertisementReceivedEventArgsMBS class that provides data for a received event of these objects. A WindowsBluetoothLEAdvertisementReceivedEventArgsMBS instance is created when the Received event occurs on a WindowsBluetoothLEAdvertisementWatcherMBS object.
Another useful class related to Bluetooth LE classes is the WindowsBluetoothDeviceIdMBS class. This class expresses a Bluetooth device ID. In its properties we can then see if it is an LE Device or a Classic Device.
In the WebView2 topic we have added new methods to the DesktopWebView2ControlMBS and WebView2ControlMBS classes to help you work better with the WebView content. You can either make selections yourself or select the whole content with the method SelectAll. Matching to this we have the methods copy, which copies the content to the clipboard, past to put content in other places, cut to cut content and copy if it can't be cut. To deselect the selection when we don't need it anymore, we have the method ClearSelection. Also we have the new method Print that asks the WebView to show the print dialog.
In the User Notifications section there are a few new features for Windows users. If you have set text, image and other properties for the user notification you can now use the new method Create to create the OS object. We have also added new properties in this class. The property ExpiresOnReboot indicates whether the toast notification will remain in the Notification Center after a reboot. The new method DataValues allows you to store data for your app with the notification. Using the method Group we gets or sets the group identifier for the notification. We also have the Priority method which, as the name suggests, sets the priority of a notification. You can also specify whether notification mirroring should be possible. For this you set the NotificationMirroring property. Also whether a toast's pop-up UI is displayed on the user's screen can be decided with the SuppressPopup property.
We also have the new class WinUserNotificationExceptionMBS that takes care of possible errors.
We hope you will also find some interesting new features. We wish you a lot of fun with MBS Xojo Plugins version 22.2. If you have any Ideas for new cool features, need a license or have any questions, please contact us.