Article Preview
Buy Now
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
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.