In this article I want to introduce you the new functionalities from the MBS Xojo Plugins in version 21.0.
Let's start with the new methods from the class MemoryBlock. With the SetBitMBS method we can set a single bit. To do this, we first specify the bit that should be set by its number. Then we have several other options to choose from. If we make now no further specifications to the value then the value of the bit is set automatically to 1. If we pass a 1 or a 0 in the parameters, the bit is set accordingly. If we pass a true or false then the bit is set to 1, according to the logical values, for true and to 0 for false. With the method IsBitSetMBS you can check whether the bit is set. With the method GetBitMBS you get the value of a bit. If you want to reset the bit to zero you can use the method ClearBitMBS.
Dim m As New MemoryBlock(100)
Dim v1 As Boolean = m.IsBitSetMBS(123)
We have also a new method for the component DynaPDF. With the method GetTypoLeading from the DynaPDFMBS class we get the typographic leading or line height of the active font. The method can be called after a font was activated in the graphics state, e.g. with SetFont(), SetFontEx(), SetCIDFont(), or ChangeFont(). This helps you to layout your PDF document.
For WriteFText, WriteFTextEx and ConvertStyledText can now use a given leading relative to the font size as shown in the example output on the right.
Additionally we have two new Properties. In the properties you find the information about the number of warnings (WarningCount) and the number of errors (ErrorCount) that occurs while the creating of the PDF.
DynaPDF got new functions to convert a PDF page to outlines with the Optimize function. This makes copying the text impossible as all font information is converted to vector graphics. Outlines are vector graphics describing how a font looks and are highlighted in different colors here:
New functionalities for Windows users
We have also new functionalities especially for Windows users
The new WindowsReportErrorMBS class is useful for error reporting on windows. This class is for an event source on Windows to report errors. With the class method Report, we write an entry at the end of the event log. In the parameters of this method we can specify the event type. So we can specify if it is an error, information or warning. Furthermore we can specify the error category, the event ID, the error description and the memory block.
The class DirectShowPinMBS got new functionality. With the class DirectShowPinMBS we have an interface exposed by all input and output pins. The class itself can’t be instantiated, but we get the class through some methods as a return. We have new methods with which we can query information about the pins.
Name: This method return the name of the pin
ID: This method gives us the identifier for the pin.
Direction: The method query, if the pin is an input or an output pin
MediaTypes: This method list all preferred media types
ConnectionMediaType: If we have a media type for the current connection to the pin, this method return the type
Accept: With this method we check, if the pin accepts a special media type. We specify the media type in the parameters. As return value we get true or false
BaseFilter: With this method we queries the BaseFilter.
ConnectedTo: The ConnectedTo method returns, if it exists, a pointer to the connected pin
New functionalities for Apple users
The MBS Xojo Plugins in version 21.0 offers also some new features for Apple users.
We are very happy that we can now also offer plugins for the use of Xojo on iOS. and of course one focus of this release is to enable compatibility for many functionalities of the plugin.
One topic that we have already opened up for iOS is MapKit. You can now also use the functionality of the Maps application on iOS. This is made possible by the new MapKitIOSControlMBS control. Show maps in your iOS apps and calculate routes to a destination.
Create animations for iOS with SCNIOSControlMBS control using SceneKit.
You can display web pages with the WKWebViewIOSControlMBS control which can be controlled with the functionalities from the WebKit2 topic.
iOS app running on Mac
In this context, we have a very interesting property from the NSProcessInfoMBS class. The property isiOSAppOnMac indicates whether the process is an iPhone or iPad app running on a Mac. The value of this property is true only when the process is an iOS app running on a Mac. This property is a read only property.
We have new methods for class AVAudioEngineMBS. You can now use the new method attachedNodes to attach all audio nodes to your audio engine simultaneously. With the attachNode method, this was previously only possible for each node individually. You can use the new method attachedNodes if you are working with versions of macOS 10.15 or iOS 10.13 or newer.
We also have three new methods that affect manual rendering. You can now use the manual rendering mode. Manual rendering has the advantage, so that you can convert audio files without playing them in real time, but faster. You can use the enableManualRenderingMode method to configure the engine to render in response to requests from the client. In the parameters we set the PCM format that must match the format of the rendering buffer. Additionally we set the maximum frame count in the parameters. You must stop the engine before calling this method.
The renderOffline method makes a render call to the engine. It operates in the offline manual rendering mode. The method disableManualRenderingMode disables the manual rendering and the engine renders to or from an audio device.
Now let's look at the new methods of the KeychainManagerMBS for Mac and iOS class. With the AddItem method we can add one or more items to the default keychain. In the parameters we set the attributes dictionary. With the new method AddItemAsync we have the asynchronous version of AddItem. To be able to outsource the work on threads we need a delegate handler. We specify this handler in the parameters. It is called with the result.
We have also new functionality for the class LAContextMBS. You can use this class for local authentication via password or TouchID under Apple and iOS. With the method setCredential we can set the credentials as memory block. In an other parameter we set the credential type as integer. With isCredentialSet and a credential type in the parameter we test, if we have set a credential with this type.
With the method TouchIDAuthenticationMaximumAllowableReuseDuration you can specify the maximum value that the property LAContext touchIDAuthenticationAllowableReuseDuration can accept. In this property is specified the time interval for accepting a successful Touch ID unlock from the past.
The Collection View is a completely new topic on Mac in the MBS Xojo Plugins. It is about the dynamic display of images and files in grids. The most Apple users will already know this technique from the app Photos because the photos are also displayed with the help of a Collection View. When you zoom in or out of the Photos window, the program automatically scales the thumbnails to show the whole row. If it becomes too tight, the sidebar will be hidden.
You can now use the Collection View in your Xojo applications with the NSCollectionViewControlMBS control. You can position this on your windows. You should be sure to bind the edges of the control to the edges of your window, because the dynamic scaling of the control is quite useless, if the size of the control in a window is constant. You can then use the functionalities from the new area to create Dynamic Collections. So, as shown in the example of this section that comes with the plugin, you can have a collection view with images that adjusts the number of columns to the width of the window. Let your creativity run wild and try it out.
We hope you will also find some interesting new features. We wish you a lot of fun with MBS Xojo Plugins version 21.0. If you need a license or have any questions, please contact us.
By Stefanie Juchmes