Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 18.2 ('Listbox Drawing')
Instant purchase and download via GumRoad!


From Oops to OOP

How using an object-oriented approach makes programming the ListBox easier and more fun

Issue: 18.2 (March/April 2020)
Author: Markus Winter
Author Bio: Markus is a Molecular Biologist who taught himself REALbasic programming in 2003 to let the computer deal with some exceedingly tedious lab tasks. Some call it lazy, he thinks it smart. He still thinks of himself as an advanced beginner at best.
Article Description: No description available.
Article Length (in bytes): 13,307
Starting Page Number: 43
Article Number: 18204
Related Link(s): None

Excerpt of article text...

There was a recent question on the Xojo forum on how to achieve the look shown in Figure 1 with a ListBox:

There are, of course, two principal solutions to the problem of drawing across columns and rows in a ListBox:

draw the text in each cell (aka row and column) so that it overlaps in such a way as to appear as one continuous line of text that spans columns and/or rows

use just one column and draw the text and fake column and row borders where necessary

I have to confess that I am a big fan of essentially using the ListBox as a Canvas with build-in scrolling that lets you draw whatever you want wherever you want it in a ListBox cell. And the solution offered in the thread works perfectly fine and is exactly what was asked for... but this problem is an ideal example for showing off the benefits that applying OOP concepts can bring to your programming (especially in the long run) and for teaching good coding techniques too, so I couldn't pass up the opportunity to dig a bit deeper.

Doing it the Oops! way

...End of Excerpt. Please purchase the magazine to read the full article.