The Top 10 from the MBS Xojo Plugins in 2022

In this article I would like to present you 10 highlights from the MBS Xojo Plugins innovations of 2022.

MongoDB

The MongoDB section joined the family of plugins in release 22.3 and has been developed further since then. You can use Xojo to access MongoDB databases, read, write and delete data. The special thing about Mongo DB is that it is not a rational database that is limited by relationships and tables, but is based on a JSON-like structure that also allows unusual queries. For example, you can formulate searches to see who has been in your company longer, the carpet in the warehouse or your employee. In rational databases, your carpet wouldn’t normally appear in the same table as your employee. So you would have to design a separate table to be able to make this query. In Mongo DB, the records, here called documents, can coexist in the same collection and a simple query can be made.

In Release 22.5, another important innovation was added for this area. You can now also execute transactions on MongoDB. Normally, every change in the database is immediately applied as soon as it has been made. But this is not always desirable, e.g. when it comes to security relevant things where multiple records have to be changed. If in the middle the connection breaks we don’t know in which state our database is, which records have been changed, which not. For this there are the transactions, with which we can tell the database to make all changes at once or to reject all changes made.
If you would like to try Mongo DB, please check out our examples.

Scintilla

In Release 22.0 we have added the Scintilla text editor to the plugins. With the DesktopScintillaControlMBS control and the ScintillaControlMBScontrol you can display the text editor in your solutions. You can not only write simple texts but also mark special keywords. Scintilla Lexer provides you with languages for well-known programming and markup languages, which you can load as needed. It provides lexers for syntax highlighting in over 100 languages including SQL, JavaScript and HTML. We added a Xojo lexer to highlight code for XojoScript. You can also specify your own keywords that will be highlighted in your texts. Scintilla supports not only the highlighting of words but also features that other script editors have, such as setting breakpoints or script folding for better clarity. The Advanced Script Editor in your program test it out.

XML

In our release 22.4 we have introduced a new feature for the users of XML. You get with the new release the possibility not only to use the on-board functionalities to XML of Xojo, but can use from now on also the functionalities from the new MBS Xojo XML Plugin. We provide for you by now 32 different classes to help you in working with XML. For example, you can validate XML texts. You can compare XML texts and even single nodes. With a good performance and Unicode support you can write, read and change data. You can also work with primitive threads in this area, for example to load an XML even faster. The plugin can do a lot more, try it out. 2023 will certainly also join one or the other function in this area.

PCRE2

In the Regular Expressions topic this year we had 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:

These classes have the advantage that they are much more efficient. This is made possible by the built-in compiler, which compiles just in time. This works with Intel as well as ARM processors. We can find multiple patterns in a text by making the same query several times on the text. We then loop through the results as well. We can save and load compiled patterns. For example, we can create a database of patterns that we need frequently. These must then be loaded and can be used afterwards.

Phidget

We added Phidget classes around 2010 to our MBS Xojo Plugins. We kept that running and various clients used all the old classes for various projects. To keep compatibility we renamed the old classes with a prefix Old, e.g. OldPhidgetMBS. To support the new Phidget Library with support for Apple Silicon, we created in Release 22.1 new classes with the modern API. We can put in all the knowledge we got about C++ and Xojo and improve the classes to current standards. We wrap the C API from Phidgets library and so you can always look on their documentation, too. If you use a humidity, magnetic, light, gyroscope, PH, sound, temperature, capacitive touch or pressure sensor for a Xojo project, you can try the new classes. You can recognize input from analog and digital sources and output signals. You can control various motors including steppers. So if you want you can build your own weather station for your garden, program it with Xojo and display the values like temperature and humidity on a screen.

Dyna PDF

Also in 2022 there were some innovations in the DynaPDF topic.

Sometimes it can be quite difficult to display fonts the way you want them to be displayed, especially when there is the factor of two different output languages. You can now create an alternate font list. These glyphs are used when the desired font cannot be used. Multiple lists can be created because different fonts and languages require different fallback fonts. For example, one could create a list for proportional fonts and another one for fixed pitch fonts, or different lists for different languages. Each list can be activated or deactivated with ActivateAltFontList as often as you like. Changing the active alternate font list is very fast and causes no overhead. Once a font list was created it can be filled with data with SetAltFonts. A font list that is no longer needed can be deleted with DeleteAltFontList. Alternate font list are tested if one more glyphs were not found in the current font. Since the fonts in the list are used as fallback they should be compatible to the active font in regard to properties like serif, sans serif, proportional or fixed pitch, and so on. A list should be sorted by priority and not by name. That means index 0 should contain a font name that is most probably the best match. If this one was not available or incompatible then the next font in the list will be tested until the end of the list was reached. If no suitable font was found then system fonts are tested. The fonts in the list should support the language that must be output. Otherwise, the fonts can never be selected. An alternate font list can be arbitrary large but it is usually best to restrict the number fonts in a list to speed up processing. The new SpaceWidthFactor property from the DynaPDFMBS class allows you to control how the ExtractText function adds spaces. With the method SetRenderingIntent in the same class we can define how our application should interpret colors in an image.

With DynaPDF we can also create archivable PDF files. So PDF files in PDF/A format. Since 22.1 we also have the possibility to create the special formats PDF/A-2u and PDF/A-3u.

Photo Picker

In the iOS section, there is an improvement for selecting images in your app. Until now, you always had to use the UIImagePickerController class to pick images from your photo library for your app. With the new version you now get the possibility to use the new PHPickerViewControllerMBS class for this task. This brings some advantages: Deferred image loading and recovery UI

  • Reliable handling of large and complex assets, like RAW and panoramic images
  • User-selectable assets that are not available for UIImagePickerController
  • Configuration of the picker to display only Live Photos
  • Availability of PHLivePhotoMBS objects without library access
  • Stricter validations against invalid inputs

In this class we can also filter the selections by placing an object of the PHPickerConfigurationMBS class in the configuration property, which we then feed with the necessary information such as the filter or the selection limit. With the method Present from the PHPickerViewControllerMBS class we can display the PhotoPicker and make our selection. When we have finished the selection, the event didFinishPicking fires and returns an array of objects from the PHPickerResultMBS class. We can then continue working with the selected elements.

We also have a Document Picker and a Contact Picker for iOS included in the plugins. Feel free to try them out as well.

Scan Documents with iOS

Our new class VNDocumentCameraViewControllerMBS provides the ability to scan documents for iOS. The class shows a panel to allow the user to scan a document. You can call this panel with the Present method. If you have scanned the document successfully the event didFinishWithScan fires and gives us the scan result as an object of the class VNDocumentCameraScanMBS. In this object we can then, for example, query the number of pages, adjust the title of the document or process the individual pages as a Picture. This way you can generate a PDF from these pages for example.

If you would like to scan an image or document with an application running on your Mac with an iOS device that has the same account and is logged into the same network, then the Continuity Camera area from 2019 is a good choice.

WinUserNotification

The possibility to work with UserNotifications in Xojo on Windows using the plugins has been available since 2017, and this year we have added some functionality in this area. If you have set text, image and other properties for the user notification you can now use the new method Create from the WinUserNotificationMBS class 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.

Windows Bluetooth

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. Also we provide classes for GATT. GATT stands for Generic Attribute Profile. It is optimized for efficient data transfer of small amounts of data. The new class WindowsGattDeviceServiceMBS describes a GATT primary service on a Bluetooth device. It is instantiated using a device service instance path obtained by searching for a device via the Windows.Devices.Enumeration API. You can then use the new GetGattService method from the WindowsBluetoothLEDeviceMBS class to determine the associated GATT using the service ID. A WindowsGattCharacteristicMBS object represents a GATT characteristic of a particular service and is obtained via the Characteristics property of the GattDeviceService object. The new WindowsGattDescriptorMBS class specifies a GATT descriptor of a particular characteristic and is obtained via the Descriptors property of the GattCharacteristic object.

I hope you were able to take one or the other idea you saw here into your daily work. If you are missing a functionality in your everyday work, then please contact us and we will see if we can help you and who knows, maybe your idea will be in our top 10 next year. Until then, I wish you all the best and a successful year 2023.

by Stefanie

6 Likes