News from the MBS Xojo Plugins Version 20.5

In this article I want to introduce you the new functionalities from the MBS Xojo Plugins in version 20.5.

Excel - News from the XL topic

Let’s start with the innovations in the XL topic. With our plugins you can create and edit Excel documents via Xojo. In this release we have new features that extend the functionality of this topic. With the new method CopyColumn from the XLSheetMBS class you can copy the values of a column of a table into another column. This copying process is not limited to the worksheet or book. You can also copy columns between different books and sheets. In the last parameter of the method you can set the copy options. That means you can decide which type of content is copied. If that option is nil we copy everything.

An other new method is ReadValue from the XLSheetMBS class. With this method you read a value from a cell as variant. Depending on the content we return a number, a boolean, a text or a timestamp. Empty or error cells will return nil.

CURL Proxy Error

For the classes CURLMBS, CURLNMBS and CURLSMBS we have new methods that name GetInfoProxyError. This method we can return the error code of a proxy. This makes a more accurate error detection and handling possible.

SSH

With the new Constructor from the SSH2ChannelMBS class, we create a new channel. In the parameters we set an instance of the SSH2SessionMBS. The SSH2ChannelMBS class got a DataAvailable event and a new example for an interactive terminal. Take a look at it in our example folder to check our SSH Terminal example as shown here:

SQL

The SQL plugin can now report last insert ID for CubeSQL. The PostgreSQL plugin part loads LDAP libraries if needed dynamically. For that we have the methode CubeSQLLastInsertID from the classes SQLConnectionMBS and SQLDatabaseMBS.

Unsigned Integers

We improved the handling of unsigned integers with our variant related functions. We got new constants for GetVariantTypeMBS function for unsigned integers. To create arrays from values with specific types, we got ArrayInt64MBS, ArrayStringMBS, ArrayVariantMBS, ArrayIntegerMBS and ArrayDoubleMBS functions. The CompareNumbersMBS function helps to compare signed and unsigned integer values of any size correctly.

DynaPDF

We have a new method for the barcode handling under DynaPDF: The InsertBarcode method from the DynaPDFMBS class. With this method we insert a barcode with defined properties in the currently open page. We define the properties of the barcode in the parameters of this method. We start with the X and Y Position that the barcode should have on the page. Then follows the Size and alignments. In the last parameter we have the informations for the barcode content with an instance of the new DynaPDFBarcode2MBS class. This class have properties for the barcode content e.g. type, background color border width, data, datatype, DotSize, ECI level, the color of the barcode itself, the size factor, the orientation and so on.

Dim b1 As New DynaPDFBarcode2MBS b1.BarcodeType = b1.kbctUPCA b1.Data = “72527270270” Call d.InsertBarcode(100, 100, 200, 50, d.kcoLeft, d.kcoTop, b1)

The advantage of using this function is that the barcode is generated directly in the PDF and is therefore not pixelated, as it would be the case with a barcode as an image.

We also have a new method that creates a symmetrical polygon. To do this, you specify the position of the center, the radius, the rotation angle, the number of sides and the fill mode in the parameters of the DrawNGon method from the DynaPDFMBS class. The minimum number of sides is three.

Finally you can use collate and sorting with printing PDF pages on Windows.

DateTime

The new plugins embraces DateTime class and adds over 200 new methods and properties. Here are some areas where Date Time is used now: ChartDirector, AVFoundation, StoreKit, CFDateMBS and so on. In newer Xojo versions you can use DateTime or Date class, but in older Xojo versions only Date functions are available.

New functionalities for Mac users

The MBS Xojo Plugins in version 20.5 offers also some new features for Mac users.

News from the Apple Contacts

We now have the possibility to enter the name of the company in phonetic transcription in the contacts, which can be useful for business calls. For this we use the method CNContactPhoneticOrganizationNameKey from the class CNContactMBS. This functionality requires macOS 10.12 or newer.

For Apple Contacts there are two additional new methods, so you can use predicateForContactsMatchingPhoneNumber to match a contact for a phone number and predicateForContactsMatchingEmailAddress to display the matching contact for an email address from the class CNContactMBS. In this way you can find out for example if a phone number or email address is already stored in your contacts. If the phone number or email address is not yet stored in the contacts, we get an error and can create a new entry for example.

Apple Typical Icons

You want to use Apple typical Icons in your solutions e.g. you want to show that your solution is capable of AirPlay and because that you want to show the Airplay icon. You can now use our new method imageWithSystemSymbolName from the NSImageMBS class to do this. With the indication of the name of the desired symbol image is created. The size you can set in the NSImageMBS instance. Here you see an example for a Image of the trash symbol

Dim n As NSImageMBS = NSImageMBS.imageWithSystemSymbolName(“trash”) If n <> Nil Then n.setSize(300,300) Backdrop = n.CopyPictureWithAlpha End If

You can find the list of the symbols under developer.apple.com/design/human-interface-guidelines/sf-symbols/overview/. This function needs macOS 11.0 or newer.

New functionalities for Windows users

Last but not least I want to introduce the new functionalities for Windows users.

Windows ML

One of our new functionalities for Windows is machine learning for Windows. Since a while we made machine learning already possible for the Mac. You can now e.g. identify the main object on an image under Windows. What exactly you want to do depends on your model.

The WinLearningModelMBS class is the main object you use to interact with Windows ML. You use it to load, bind, and evaluate trained ONNX models. The class is an abstract class. You can’t create an instance, but you can get one from one of the load methods. After that you must enumerate the InputFeatures and OutputFeatures and bind that to your model. For that you have the WinLearningModelBindingMBS class. In the end you create a LearningModelSessionMBS instance and evaluate the machine learning model. The machine learning functionalities are Windows 10 only.

WebView2

With the new WebViewer 2 Control you can add interactive content like HTML, CSS and JavaScript to your applications. We already introduced some functions on this new topic in earlier releases this year. Now there is finally the matching control. More information and the required installers for using this control can be found on the Windows website under the following link: developer.microsoft.com/en-us/microsoft-edge/webview2/ The installers are needed if you don’t have the 2021 version of Windows, which may include it pre-installed.

Of course the new control also includes many new events. You have to pay attention that the events run asynchronous. E.g. it can take a few seconds until Open is executed before Opened is executed.

Windows Font Family

The new method AllFontsEx from the WindowsFontFamilyMBS class queries all fonts on the current windows machine. The font list is queried from OS and not cached, so this should update if new fonts are activated. To display a list of all available fonts in a dialog box, you can use the following lines:

dim lines(-1) as string for each f as WindowsFontFamilyMBS in WindowsFontFamilyMBS.AllFontsEx lines.append f.LogFontFullName next MsgBox Join(lines,EndOfLine)

We hope you will also find some interesting new features. We wish you a lot of fun with MBS Xojo Plugins version 20.5. If you need a license or have any questions, please contact us. by Stefanie Juchmes