Chapter 13. StaticControl Class

Table of Contents
new (Class method)

Static controls are used in applications as labels or to separate groups of controls. Although static controls are child windows, they cannot be selected. Because of that, they do not receive the keyboard focus and do not have a keyboard interface. A static control can have a notify style. With this style the control will receive mouse input and then notifies its parent dialog when the user clicks or double clicks the control.

There are four basic types of static controls. Each type has one or more styles.

Simple Graphics

Simple graphic static controls draw a filled rectangle or a frame. Text static controls display text. Image static controls display an image, icon, bitmap or enhanced metafile. ooDialog does not have much, if any, support for owner-drawn static controls.

The StaticControl class provides methods to query and modify static controls. By default, static controls are assigned a resource ID of -1. There is no way to query or modify static controls unless the control has a positive resource ID. Which in most circumstances is fine, usually static controls do not need to be modified. Be sure to assign a positive resource ID to static controls that will be modified during the execution of a dialog.


The StaticControl class requires the class definition file oodWin32.cls:

::requires "oodWin32.cls"

Subclass of:

The static control class is a subclass of the DialogControl Class and therefore inherits all methods of that class.

Mixin Class Inherits:

The static control class inherits from the following mixin classes, (indirectly through the DialogControl class.)

The WindowBase

The WindowExtensions


Use the getStaticControl() method to retrieve an object of the static control class. To use this method, the static control must have a positive ID.

Dynamic Definition:

To dynamically define a static control in a UserDialog class, use one of the Add Static Control methods.

Event Notification

To recieve notification of static control events use the connectStaticNotify)() method.


The StaticControl class implements the class and instance methods listed in the following table:

Table 13-1. StaticControl Instance Methods

Method......on page
new (Class method)new

new (Class method)

The static control class is not intended to be instantiated directly by the programmer using the new() method. Rather the programmer should obtain a new static control object by using the getStaticControl() method of the .AdvancedControls class.