In this article I want to introduce you the new functionalities from the MBS Xojo Plugins in version 21.5.
Xojo 2021r3 introduces new Desktop controls and we updated our own controls for this change. Whether you use Window or DesktopWindow, in both cases you can enjoy one of our 29 controls. Maybe you didn’t know that there are so many controls from MBS for Xojo?
Therefore we would like to give you a list of these controls. Maybe you will discover one that can improve your application.
There are also a few new features for the XL topic. First, we have two new methods that affect the AutoFilter. The AutoFilter allows you to filter entries according to specified criteria. With the method IsAutoFilter from the XLSheetMBS class we can determine if such a filter is set for this worksheet. If a filter is set, the method returns true. The AddSort method from the XLAutoFilterMBSclass adds a sort criteria to the AutoFilter. So you can decide if a result set should be sorted by a certain column in ascending or descending order.
With the latest functionalities from XL you can also fill out Excel forms. With the property FormControlCount from the XLSheetMBS class we first find out how many form elements there are in a form at all. With the method FormControl from the same class, we can find out something about the form element by specifying the index. We get an instance of the class XLFormControlMBS from this method. This object then contains information about the form element. For example, you can use the property “name” to query the name of the element or what kind of object it is. The class contains methods that make it possible to insert values in a list box or in the drop-down menu. You can use this functionality to automate the filling of your forms. For the creation of forms you may need a version of Excel.
But not only in Excel there are innovations in the area of forms in this release, but also DynaPDF brings innovations in relation to forms. We have two new properties in the class DynaPDFFieldExMBS, which objects provide information about a previously defined field in a PDF. With the FmtTextColor property we read the defined font color of a field for formatting. The FmtText property gives us the text for a text field. In addition, we have two new AddButtonImageEx2 methods in the DynaPDFMBS class that make it possible to store an image for a button in the form. These images can now be passed as MemoryBlock and as String.
Additionally, there is the new ScreenResolution property from the DynaPDFRasterizerMBS class. With this property you can set the screen resolution in DPI. The screen resolution is sometimes required, e.g. to render text annotations correctly. This type of annotation has a fixed size that is independent of the current scaling factor. However, the correct size depends on the screen resolution on which the image is rendered.
We would also like to mention the new methods GetInPDFVersionEx and GetPDFVersionEx from the DynaPDFMBS class. The GetInPDFVersionEx method retrieves the version information of the currently open import file. GetPDFVersionEx retrieves the major and minor version of the PDF document as well as the underlying PDF standard, if any. Both methods return an object of the class DynaPDFVersionInfoMBS which contains the individual information.
You can see the values of this small example in the debugger:
The MBS Xojo Plugins in version 21.5 offers some more new features for Mac and iOS users
In the NSSharingServiceDelegateMBS class we have four new events that improve content sharing. The event didCompleteForItems fires when the sharing did complete. If an error message occurred during sharing, it will be passed along with it. For this reason it should be checked when the event is used to handle errors.
The event didSaveShare is called when the cloud sharing was saved. We also have the event didStopSharing which is called when the sharing is stopped for whatever reason.
Also, you can now use the optionsForSharingService event. It tells us which options are allowed for the share. The options that are returned by this method describe how the user is allowed to configure the share: whether the share is public or private, and whether participants have read-only or read/write permissions.
Already since version 16.5 the CloudKit component contains the class NSPersonNameComponentsMBS. It is used to specify a person’s name by providing the components comprising a full name: given name, middle name, family name, prefix, suffix, nickname, and phonetic representation. Since this version there is a method formatted that outputs the information about the name formatted, so that we can output it for example in a text field. Here we see a small example:
Dim n As New NSPersonNameComponentsMBS n.familyName = “Smith” n.givenName = “Bob” Dim a As NSAttributedStringMBS = n.formatted Dim tv As NSTextViewMBS = TextArea1.NSTextViewMBS tv.textStorage.setAttributedString a
The new CGColor property from the EKCalendarMBS class adds color to your calendar entries. This property, which can be read and written, sets the color of a calendar entry in EventKit. It is the equivalent of the color property for macOS.
Last but not least I want to introduce the new functionalities for Windows users.
For our MBS Xojo Plugins we add a thread pooling for Windows in version 20.4. Instead of having the plugin create threads if needed for doing work and reuse them if needed. For version 21.5 we got a new class to control that: WinThreadPoolMBS
The default stack size is 1 MB with a grow rate of 4 KB. Thread minimum and maximum is not limited, so Windows can decide based on CPU core count and load. If you don’t use the class, you get the default behaviour: a shared thread pool for the whole process. This may also be used by plugins from other vendors. But if you use this class, we create a thread pool for our MBS Plugin functionalities and you can configure how much we use it.
There is also a new property in the WindowsKeyFilterMBS class. This class can filter various windows keyboard shortcuts. With the BlockShiftSpace property you can specify whether shift-space combinations should be filtered or not.
I would like to introduce a new event: NewWindowRequested from the WebView2ControlMBS class. The event is calling when a new window needs to be opened. This necessity can also be indicated when e.g. the user selects an anchor tag with target or the event was triggered by a programmatic window open from a script that directly run as a result of user interaction such as via onclick handlers. By the way, the event also creates an instance of the new WebView2WindowFeaturesMBS class, that hold information about the new window like: Height and width, top and left position and display options.
For the WebView2ControlMBS class we have also three new properties. In the DefaultBackgroundColor you can set the color that the web viewer renders underneath all web content. This means WebView renders this color when there is no web content loaded such as before the initial navigation or between navigations. Additional it also means web pages with undefined css background properties or background properties containing transparent pixels will render their contents over this color. Web pages with defined and opaque background properties that span the page will obscure the DefaultBackgroundColor and display it normally. The default value for this property is white to resemble the native browser experience.
The UserDataFolder property contains the user data folder location. You must set this absolute or a relative file path before the initialization of the control runs. The same is true for the BrowserExecutableFolder property, that describes the path to the browser executable folder that should use.
We hope you will also find some interesting new features. We wish you a lot of fun with MBS Xojo Plugins version 21.5. If you need a license or have any questions, please contact us.
Written by Stefanie Juchmes. If you need help to get started with those functions, feel free to contact us and request assistance. Stefanie can help via screen sharing.