Skip to content

Category: Tips

sort code tips and tricks

Conditional Breakpoints

You can set breakpoints in your Xojo code that cause the debugger to appear when the line of code with the breakpoint is reached. This is incredibly handy to help understand and test your code.

Comments closed

Introspection

Introspection is a very handy and useful part of the Xojo language.

You can use it to examine a lot of the objects that are in memory at runtime. You can access the properties in those objects, call methods on those objects and even create new instances (with some caveats here).

But there are limits to what you can do with it. You can’t use it to create things that do not exist at runtime because they’ve been stripped out when your app was built.

Comments closed

Code Refactoring Tools

Wikipedia defines Code Refactoring as:

the process of restructuring existing computer code – changing the factoring – without changing its external behavior. Refactoring improves nonfunctional attributes of the software.

Did you know that Xojo has a bunch of refactoring features that can help make this process more efficient?

Comments closed

An Introspection Gotcha

Introspection is a very handy and useful part of the Xojo language.

You can use Introspection to examine many of the objects that are in memory at runtime. You can access the properties in those objects, call methods on those objects and even create new instances- with some caveats of course.

Comments closed

Easily Sorting Arrays of Classes

Sometimes you’re going to need a data structure that is an array of classes and you’re going to want to sort them. The standard array Sort method can only sort simple types (Text, Integer, etc), so what do you do?

The traditional technique has been to use SortWith. You create a separate array of a simple type, populate it and then sort the temporary array using SortWith to sort the class array.

But there is an even slicker way to sort that was added in 2015 Release 3. You can now create your own custom comparison method and use that to sort the class. This custom method returns 0 if the values to compare are equal, a positive if the first value is greater than the second, and a negative value if the first value is less than the second.

Comments closed

Sorry, You’ve Run Out of Memory

Most of us build apps without thinking too much about how much memory the app will need. Sure sometimes you end up creating an app that is a real memory buster but that’s unusual. With virtual memory, gone are the days when your app would just run out of memory and crash, or are they?

Comments closed