Special

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 4.4

FEATURE

Implementing Scrollable Control Lists

Issue: 4.4 (March/April 2006)
Author: Charles Yeomans
Author Bio: Charles is the author of "I Declare: Calling External Functions in REALbasic, available online at http://www.declareSub.com/.
Article Description: No description available.
Article Length (in bytes): 14,944
Starting Page Number: 27
Article Number: 4411
Related Web Link(s):

http://www.declareSub.com/

Excerpt of article text...

Scrollable control lists are common in user interfaces of all sorts of applications. In this article, we will write a simple example to illustrate an approach to implementing them.

There are two main problems around which one must design. The first is that the only ways to create controls at runtime are to use control arrays or ContainerControls. This limits the extent to which one can write reusable classes. To some extent, one can work around this by using events to provide hooks for creating controls. But I've not had good luck with such an approach for control arrays. And each time I write a scrolling list, the UI is just different enough so as to require rewriting.

The second problem is REALbasic. Redrawing problems abound in the interaction of controls and scrolling. And ContainerControls remain a work in progress. In particular, layering ContainerControls does not really work yet.

Despite this, it is certainly possible right now to write decent scrolling lists in REALbasic. I use the basic design that follows in my own applications with goood results. So let's dive in.

Use a ContainerControl

We will use a ContainerControl as the basis for our scrolling list. I am not entirely comfortable with this, because ContainerControls are available only in REALbasic Professional. But they are not absolutely necessary; their role is that of a Mediator (as in the pattern), allowing me to encapsulate a lot of code that would otherwise go into a Window. Since it is not hard to eliminate the use of ContainerControls in the code to follow, we will use them here.

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