In this article I want to introduce you to the new functionalities from the MBS Xojo Plugins in version 23.1.
The new methods in MongoDB should make your work with Mongo DB much easier. We have added aggregate functions for you to query data by applying a filter, sorting rules and grouping either to the entire database or only to a specific collection. Also, we can query the TLS status of the database to see whether the connection is encrypted. Using the property Options from the class MongoURIMBS we can query the options of a URL. It fetches a JSON document containing all the options provided after the ? of a URI.
Also in the DynaPDF section we have 2 new methods for you. You can rename named destinations with the method ChangeNamedDest in the DynaPDFMBS class. In the parameters you first specify the type of the object, then the object handle and finally the new name of the destination. The other method is the CreateStructureTreeEx method. Already since version 8.2 there is a related method CreateStructureTree, which creates a global structure tree that is required to create tagged PDF files. The new method has the additional possibility that we can specify the type of the root node. Otherwise the two methods work identically. DynaPDF added support for writing PDF/UA-1 files and update the DynaPDF library to 22.214.171.124
In the XL area, we have added some methods that should simplify your work with Excel documents even more. In the class XLSheetMBS we have new methods that deal with the selection of ranges. with the method AddSelectionRange you add a selection to the range. With the SelectionRange method you get back the selected range. RemoveSelection cancels all selections. We also have the possibility to set the currently active cell. For this we use the method SetActiveCell and specify the row and column in the parameters. With the new property TabColor you can set the sheet’s tab color. With the property DefaultRowHeight we can set and query what the default height of a row is. Also new we have the property IsWriteProtected from the class XLBookMBS. This returns true if we have a write protected file, so we can only read the workbook.
Call delegate in threads
The new experimental methods CallDelegateOnPreemptiveThreadMBS from the CallDelegatesMBS module call a delegate on a preemptive thread. Feel free to try this functionality in your projects and check out our sample project.
CGS Window for Mac
For Mac users we have this time two new shared methods from the class CGSWindowListMBS. An object of this class represents an array of CGSWindowMBS objects dealing with windows in the CoreGraphics system. With the PreflightScreenCaptureAccess method we check if the current process already has screen capture access. The other method is called RequestScreenCaptureAccess and requests event listening access if absent, potentially prompting. Both methods require macOS 10.15 and newer.
New functionalities for Windows
The MBS Xojo Plugins in version 23.1 offer some more new features for Windows users
An absolute highlight in this release is the new Windows OCR. It allows you to use the OCR functionalities already integrated in Windows 10 also in Xojo. For this purpose we have provided these new classes for you.
First we can check with the method Available from the class WindowsOCREngineMBS if the computer on which we run the application can use the OCR functionalities at all. And with AvailableRecognizerLanguages we can query the possible languages, which are then delivered to us as an array of WindowsOCRLanguageMBS objects. If we want to recognize the text of a picture, we call the method RecognizeAsync in a previously created instance of the class WindowsOCREngineMBS and pass the picture as picture, folderitem, memory block or similar. Then we can wait for the event RecognizeCompleted to fire and return us the result as WindowsOCRResultMBS object. The result can then be read out as text, or we can use the Lines method to get an array of the individual result lines that occur as WindowsOCRLineMBS objects. These consist then again of single words, which are represented with WindowsOCRWordMBS objects. WindowsOCRExceptionMBS takes care of errors that may occur during the process. If you want to learn more about this topic, please read our blog article: Windows OCR for Xojo or try our example that comes with the plugin.
I hope you brought a little hunger with you, because we have added two new classes in the WebView two section that deals with cookies. With the new class WebView2CookieManagerMBS you can add, change and delete cookies. The individual cookies are represented by instances of the WebView2CookieMBS class. So handle your cookies with the new classes. You can read more about this in our blog article WebView2 and Cookies in Xojo.
Last year we implemented a method that allows you to print the content of your web viewer via dialog. Now we want to make it possible that you can print the webviewer content directly as PDF. For this you use the PrintToPdf method from the classes WebView2ControlMBS or DesktopWebView2ControlMBS. You then specify the save path in a parameter. If there is already a PDF at this location it will be overwritten, otherwise a new PDF file will be created. If you terminate the application before the PDF has been created completely, the process will be aborted and the PDF will not be saved. To prevent this we have added an event to the two classes which fires when the PDF has been saved on disk. With the event we also get the information back if the writing of the PDF was successful.
We have added the Windows Store component to the plugins in 2020. This deals with in-app purchases in the Windows Store. In this release we have three new classes for this componte. First, the class WindowsStoreImageMBS. It represents an image that is associated with a product listing in the Windows Store. The same applies to the WindowsStoreVideoMBS class which represents a video instead of an image. Matching to this we have the methods Images and Videos from the classes WindowsStoreSKUMBS WindowsStoreProductMBS which work with objects of these new classes.
Objects from the new class WindowsStoreLicenseMBS provides license info for a durable add-on that is associated with the current app. To retrieve StoreLicense objects for the durable add-ons for the current app, use the WindowsStoreAppLicenseMBS.AddOnLicenses property. This property contains only the add-on licenses that are still valid and provide the current user with an entitlement to use the add-on. When an add-on license expires or is longer valid, it will no longer be available in the WindowsStoreAppLicenseMBS.AddOnLicenses collection.
We hope you will also find some interesting new features. We wish you a lot of fun with MBS Xojo Plugins version 23.1. If you have any Ideas for new cool features, need a license or have any questions, please contact us.