Chapter 10.  Abstract Control Classes

This chapter describes two built-in REALbasic classes that the programmer can neither instantiate nor subclass: Control and RectControl. You might wonder: if you can’t make an instance of either of these classes, and if you can’t make a subclass of either of them, what good are they? The answer is that although you can’t subclass these classes, REALbasic can, and has. RectControl is a subclass of Control. Every built-in control class is derived from Control, and most are derived from RectControl; and you can instantiate or subclass these built-in control classes. (For a diagram, see Section 4.6.)

A class that exists only so that other classes can be derived from it is said to be abstract . Its purpose is to express and encapsulate the common functionality of its subclasses. The Control and RectControl classes each receives certain events and has certain methods and properties, and all of their respective subclasses inherit these and have them in common. Thus, this chapter is really about the events, methods, and properties common to control classes.

Each of the built-in Control subclasses—except RectControl, which is abstract—is represented by an icon in the Tools Window. This icon can be dragged into a Window Editor to cause a window class to contain an instance of that control. The window will then instantiate the control automatically when it itself is instantiated. Moreover, this is the only way in which these subclasses ...

Get REALBasic: TDG, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.