« MBS Xojo Conference -… | Home | MBS Xojo Conference -… »

News from the MBS Xojo Plugins Version 24.3

In this article Stefanie introduces you to the new functionalities from the MBS Xojo Plugins in version 24.3

Python

I would like to introduce you to the highlight of this release right at the beginning. You can now use Python code in your application with the help of the MBS Xojo Plugins. This programming language, which appeared in the 90s, is one of the most popular of its kind and is used by many developers. We are therefore pleased to be able to open up this world to you in this release. Our new PythonMBS class can load a local Python library and evaluate expressions or run scripts. Get and set variables in Python to exchange data in memory. The Python code can optionally call back to Xojo code with custom functions

We discuss this topic in more detail in our blog article Using Python in Xojo. Take a look at this article and take a dip into the world of Python with Xojo.

DynaPDF

DynaPDF has also received new functionalities in this release. With the method SetLineAnnotPoints from the DynaPDFMBS class you can change the start and end point of an existing line annotation. To do this you enter the new start and end points as coordinates in the parameters.

Another new method is EnableImageCache from the same class. It creates an image cache that is used when rendering PDF pages. Caching can speed up rendering dramatically.

JSON

We have a new method in our JSONMBS class. With the isValidJSON method, we can check whether a given text is valid JSON. In the method, we specify the JSON to be checked in the parameter and receive a Boolean value as the return value.

XML

In the XMLValidatorMBS class we have a new method called CanonicalXML. We can use it to generate a canonical XML from the XML we specify in the parameter.

Dim inputtext As String = Input.Text
Dim outputtext As String = XMLValidatorMBS.CanonicalXML(inputtext)
Output.Text = outputtext

Compression and Decompression

For our compression and decompression classes ZLibCompressMBS, ZLibDecompressMBS, BZip2CompressMBS and BZip2DecompressMBS, we have added a constructor that can use an existing buffer. In addition, each class got a new method SetInput, which fills a buffer with data. We have also added a new property OutputUsedSize which gives us the number of bytes currently used in the output buffer. The new property OutputPtr gives us the pointer to the output buffer.

New functionalities for Mac

The MBS Xojo Plugins in version 24.3 offers some more new features for Mac users

Memory Host Statistics

The new class DarwinHostVMStatisticsMBS offers us the possibility to query various values of the memory host statistics for macOS and iOS. For this purpose, we have 25 different properties available that can be read out.

Here you can see an example in which some of these values are queried:

Dim d As New DarwinHostVMStatisticsMBS

Dim FreeMB       As Integer = d.FreeCount     * d.Pagesize / 1024 / 1024
Dim ActiveMB     As Integer = d.ActiveCount   * d.Pagesize / 1024 / 1024
Dim InactiveMB   As Integer = d.InactiveCount * d.Pagesize / 1024 / 1024
Dim WiredMB      As Integer = d.WireCount     * d.Pagesize / 1024 / 1024
Dim CompressedMB As Integer = d.CompressorPageCount     * d.Pagesize / 1024 / 1024

Dim Sum As Integer = FreeMB + ActiveMB + WiredMB + InactiveMB + CompressedMB

MessageBox _
  "Free: " + FreeMB.ToString+EndOfLine+_
  "Active: " + ActiveMB.ToString+EndOfLine+_
  "Inactive: " + InactiveMB.ToString+EndOfLine+_
  "Wired: " + WiredMB.ToString+EndOfLine+_
  "Compressed: " + CompressedMB.ToString+EndOfLine+_
  "Total: „+Sum.ToString

UIDevice

For iOS, we have a new class UIDeviceMBS that can store the information about our current device.We use a UIDevice object to get information about the device such as assigned name, device model, and operating-system name and version. You can also use the UIDevice instance to detect changes in the device’s characteristics, such as physical orientation. You get the current orientation using the orientation property or receive change notifications by using the OrientationDidChange event. Similarly, you can use the UIDevice instance to obtain information and notifications about changes to the battery’s charge state and charge level. The UIDevice instance also provides access to the proximity sensor state. The proximity sensor detects whether the user is holding the device close to their face.

NS Local

We improved NSLocaleMBS class for macOS and iOS to provide more information with properties. Use localizedString functions to get localized names for these identifiers and use the DidChange notification with NSNotificationObserverMBS class to get a callback if locale changes. This are the new methods and properties:

Methods:

  • localeWithLocaleIdentifier
  • localizedStringForCalendarIdentifier
  • localizedStringForCollationIdentifier
  • localizedStringForCollatorIdentifier
  • localizedStringForCountryCode
  • localizedStringForCurrencyCode
  • localizedStringForLanguageCode
  • localizedStringForLocaleIdentifier
  • localizedStringForScriptCode
  • localizedStringForVariantCode
  • NSCurrentLocaleDidChangeNotification

Properties:

  • alternateQuotationBeginDelimiter
  • alternateQuotationEndDelimiter
  • calendarIdentifier
  • collatorIdentifier
  • languageIdentifier
  • quotationBeginDelimiter
  • quotationEndDelimiter
  • regionCode

NS Printer

You can also make print settings with the plugin. In this release, we have now added the option under MacOS that you can now also make settings for duplex printing. To do this, we provide you with property from the NSPrintInfoMBS class. You can read this property but also set it. We have added suitable constants in the plugin for you to set. You can specify these constants as a value:

Constant Value Description
PMDuple 1 Print only on one side of sheet of paper.
PMDuplexNoTumble 2 Print on both sides of the paper, with no tumbling.
PMDuplexTumble 3 Print on both sides of the paper, tumbling on.
PMSimplexTumble 4 Print on only one side of the paper, but tumble the images while printing.

System Info

The new MacOS 15 with the name Sequoia will be launched this fall. We are already prepared for this and you can use the method isSequoia from the SystemInformationMBS class to check whether the new operating system is running on the computer on which your application is running.

Images

There have also been improvements to images. You can now create a reference of the NSImageMBS class for an object of the CGImageMBS class and then continue working with such an object.

We have another new method in the CIImageMBS class for iOS. The method normalizeCIImageOrientation normalizes an image based on the device orientation. It checks the current device orientation to the given start orientation to rotate the image to be in normal orientation for the display.

New functionalities for Windows

Last but not least we offer some more new features for Windows users

In the Windows Topic Bluetooth we have added some new classes. An object of the WindowsDeviceInformationMBS class represents a device. This class allows access to well-known device properties as well as additional properties specified during device enumeration. Here you can see our different properties:
  • Handle as Integer
  • Id as String
  • IsDefault as Boolean
  • IsEnabled as Boolean
  • Kind as Integer
  • Name as String

This class is mainly important for another new class: The WindowsDeviceWatcherMBS class. It watches for devices connecting. An app calls Start to begin the search for devices. During this initial enumeration, the DeviceWatcher raises an Added event for each device that's found, until all devices are found. The DeviceWatcher raises an EnumerationCompleted event when the initial enumeration is complete, and continues to raise events if a device is added, updated, or removed.

The Added event returns an object of the WindowsDeviceInformationMBS class. The Removed and Update events, on the other hand, provide us with an object of our third new class: WindowsDeviceInformationUpdateMBS. It contains updated properties for a DeviceInformation object. Here we get the handle, the id and the kind as properties.

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

18 07 24 - 09:26