Updates On Xojo API2 Conversion

Updates On Xojo API2 Conversion

As mentioned, I converted two Xojo libraries from API1 to API2.

This article is about changes made after the initial conversion and reported by other Xojo users.

Where I can, I’ll comment on those changes. The involved repositories are always updated on my github repositories before updating this article.

Thank you, to all contributors!

array.Count

Robert Livingstone reported this change request. Robert is right that since Xojo Release 2019r2 we can make use of this command, and it is more elegant than :

array.LastIndex + 1

It’s important to note that if you analyze your project in the Xojo IDE it will point you to convert the former Ubound( array ) command to array.LastIndex but doesn’t give you of course the hint that array.Count exists. For better readability, you should memorize this new command.

array.ResizeTo

This is yet another new command that the Project Analyse doesn’t point you to, but again Robert Livingstone did — thank you! From reading the Xojo documentation Redim is as well outdated:

Redim exists for Visual Basic compatibility only. Use Arrays.ResizeTo instead.

I updated the repositories and all “ Redim”s are now replaced by the respective array.ResizeTo commands.

Please note that the Xojo IDE doesn’t point you to the fact that “Var” is preferred over “Dim”. However, I had made that change already in the original version.

  • Method HexB used the deprecated version “RBVersion” in Stringutils (This item was deprecated in version 2013r1). Command replaced with “XojoVersion” as replacement.

  • In the comments for EditDistance changed “StringUtils” to “strings”.

  • In the “Metaphone” method of the StringUtils the “Dim” statements remained. They are now replaced by “Var”.

string.EndsWith

Version 2.5 Renamed method “EndsWidth” to “EndsWithOld” as Xojo has implemented “EndsWidth” into the core in late 2019.

Version 2.6 Deleted method isEmpty, as meanwhile part of Xojo Core.

Did you find this article valuable?

Support Jeannot Muller by becoming a sponsor. Any amount is appreciated!