In this article I want to introduce you the new functionalities from the MBS Xojo Plugins in version 20.3.
The classes of this topic handle the loading of dynamic C libraries and calling functions within them. Currently there are three classes.
The DeclareLibraryMBS class Allows you to load a DLL on Windows, a dylib on MacOS and shared object on Linux. It inspects the available functions and load functions by name. You can enter a path or pass a folderItem when you create an instance of this class.
The DeclareFunctionMBS class give you the possibility to call C functions. In comprehension to the built-in declares in Xojo, those functions allow a much more dynamic calling of functions with various calling conventions. We support also the possibility to define declares at runtime.
With the DeclareCallBackMBS class you can create callback functions dynamically. In the parameters you pass the function pointer to a C function which later calls back your callback.
In the JavaVMMBS class we have two new methods, named DefineClass , that allow us to load a class with raw class data from the buffer. In the parameters, we specify the class name and the data either as a string or a memory block.
For a X509 certificate you can read the property ValidNotBefore from the X509MBS class to query the creation date of the certificate and thus the beginning of its validity. With the new property ValidNotAfter you can query the expiry date. Both times are given in Greenwich Mean Time.
In the new version of the MBS Xojo Plugins we also have new methods for creating SHA3 hashes. You have the possibility to create SHA 3 hashes with a different bit base by calling the wanted method. You can choose between methods that encode numbers with the following bit bases: 224, 256, 384 and 512. The usage of on of such methods can look like this:
d.Process “Hello World”
dim result as string = EncodeHex(d.Final)
In this example we take 224 bits as bit size.
Web Kit 2
For Web Kit 2 we have a new class for the navigation, the WKNavigationMBS class. An object of this class is returned from the web view load methods and is also passed to the navigation delegate methods to uniquely identify a webpage load from start to finish.
In addition, the WKWebViewMBS class has several new functionalities for working with the WebView content. For example you can have the content output as HTML text or plain text.
Moreover, we can query Main Resource, PDF and Web Archive Data.
In addition, there are new methods to copy, cut and paste content, delete selected parts or select the whole text in a Web View.
Let’s start with a few innovations with LibXL, that allows you to edit Excel files with Xojo code. You now have properties on which you can query the area of the table where data is filled in. You can determine the first row or column in an Excel document that is filled and which is the last row or column that is filled. This simplifies your work. For example, you want to enter data in an existing table. You first determine the last filled row and then you enter the new values in the next row
There is the new WriteStringAsNumber method from the XLSheetMBS class that writes a number into an Excel spreadsheet, which is passed as text. This prevents rounding errors for floating point numbers
There are new features in the curl area. The classes CURLMBS , CURLNMBS and CURLSMBS each have a new method named SetPathProxyIssuerCert. That method sets the proxy issuer SSL certificate filename. If the option is set, an additional check against the peer certificate is performed to verify the issuer of the HTTPS proxy is indeed the one associated with the certificate provided by the option. This additional check is useful in multi-level PKI where one needs to enforce that the peer certificate is from a specific branch of the tree.
This option makes sense only when used in combination with the OptionProxySSLVerifyPeer option. Otherwise, the result of the check is not considered as failure.
The methods also bring properties for each class. You can see them here:
- OptionIssuerCertBlob as String
- OptionProxyIssuerCert as String
- OptionProxyIssuerCertBlob as String
- OptionProxySSLCertBlob as String
- OptionProxySSLKeyBlob as String
- OptionSSLCertBlob as String
- OptionSSLKeyBlob as String
New functionalities for Mac users
The MBS Xojo Plugins in version 20.3 offers some more new features for Mac users
Since a few years there is the possibility to allow applications under macOS to update themselves. Now we have added some events to the class SUUpdaterMBS .
The event updaterShouldShowUpdateAlertForScheduledUpdate is called just before the scheduled update driver prompts the user to install an update. In this way you can influence the display behavior of the dialog, for example.
If the user Dismiss the update alert, the didDismissUpdateAlertPermanently event is called.
In the parameters will then specify whether the rejection was only once or permanently, so that depending on the result you can request an update in three hours or wait until the next update.
The event userDidSkipThisVersion is called if the user chooses to skip this version. In this case, you could, for example, use a dialog to warn the user of the consequences.
After the update has been downloaded successfully, the new didDownloadUpdate event is called.
The willExtractUpdate event is called immediately before extracting the specified downloaded update. The didExtractUpdate event is called afterwards.
Some applications must be relaunched after an update. When this restart is complete, the updaterDidRelaunchApplication event is called
We also have new methods in the AVAudioPCMBufferMBS class. This class provides methods that are useful for manipulating buffers of an audio in PCM format. With the new methods setFloatChannelData , setInt16ChannelData and setInt32ChannelData we can write the belonging channel to the buffer. In the parameters we set the channel Index and the data that we want to write to the channel as memory block. The method return true if the writing was successful.
Apple has announced that they will change their Intel-based processors completely to Apple’s own Apple Silicon processors within the next 2 years. Apple’s own processors are already integrated in iOS devices. Of course we are also working on the MBS Xojo Plugins to prepare for this change. In the new version we already have two new methods that can be useful in connection with the new chips. Both new methods you can find in the SystemInformationMBS class. With the method isBigSur you can check whether the used operating system is macOS 11 Big Sur or higher. With the method IsTranslated you test if the application is translated for a Apple Silicon Macs or not.
New functionalities for Windows users
Last but not least I want to introduce the new functionalities for Windows users.
Windows Photos Acquire
For Windows we have opened up a whole new topic. The work with Windows Photos Acquire API. Our new WinPhotoAcquireMBS class lets you open a source and acquire the pictures from it, e.g. we can import pictures from a digital camera to local folder.
With the use of the WinPhotoAcquireDeviceSelectionDialogMBS class you can let choose the user the device from which we want to import. That may be a WIA, STI, File System, WPD, STI or TWAIN device as long as Windows has drivers for it. With the WinPhotoAcquireOptionsDialogMBS you can show a dialogue where the user can set options for the import. The user may just pick settings and save them for next time. There is also WinPhotoAcquireSettingsMBS class to manually configure them and define some parameters like the file name template.DirectDrawGraphicsMBS to draw 2D graphics directly into a Xojo graphics context. You can draw e.g. ellipses, lines or rectangles and of course you can combine these elements to new shapes. You can choose between filled graphics or just the frame around the graphics. This class is still new and will be filled with additional functionalities in the near future. Therefore please write us your suggestions.
For Windows you can show a debug Bar for the web bowser. With the method ShowDebugBar from the IEWebBrowserMBS class you show this bar. With the menu bar you can inspect HTML elements, see scripts and modify elements on the fly.
If you want to use the DebugBar you can download it under „www.debugbar.com" and instal it in the Internet Explorer. You may need a separate license to use all features.