Skip to content

Category: Learning

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

Easy as Pi: GPIO updates

We are always keen to see apps and projects that Xojo developers have made for their Raspberry Pi 2 and Raspberry Pi 3 single-board computers. Especially since Xojo 2019r1 when building for Pi Desktop and Console is free with Xojo Pi!

I am pleased to announce some updates to our GPIO project to make it even easier to use more types of hardware in your Raspberry Pi projects.

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

Tip: Automatic Reference Counting

As defined on Wikipedia, Automatic Reference Counting (or ARC) is a “memory management enhancement where the burden of keeping track of an object’s reference count is lifted from the programmer to the compiler.”

With object-oriented programming, each new object you create takes up space in memory. This memory needs to be managed somehow. In the beginning, this management of memory was left entirely to the programmer, such as with C++ or originally with Objective-C.

Comments closed