GroupBox Class

The Windows Group Box control is actually a button control, not a static control. Its purpose is to group together a set of related controls. It consists of a label and a rectangle. The related controls are placed within the rectangle. Group boxes have no state, they can not be selected, and an application can not send messages to the control. In addition, a group box does not send notifications to its parent so there are no events to connect to a group box.

The GroupBox class provides methods to work with group box controls.


The GroupBoxe class requires the class definition file oodwin32.cls:

::requires "oodwin32.cls"

Subclass of:

Although the group box is a button, since it does not have a state, can not be selected, does not send notifications, etc., it does not inherit from the ButtonControl class. A group box does not share behaviour or characteristics with the other button classes. Therefore, the group box class is a direct subclass of the DialogControl class. It therefore inherits all methods of that class.

Mixin Class Inherits:

The group box class inherits from the following mixin classes, (indirectly through the DialogControl class.)

The WindowBase

The WindowExtensions


Use the getGroupBox() method to retrieve an object of the group box class.

Dynamic Definition:

To dynamically define a group box in a UserDialog class, use the addGroupBox() method.

Event Notification

Group boxes do not generate notifications.


The GroupBox class only implements a few methods, (actually only one method at this time.)

Table 14-5. GroupBox Instance Methods




Assigns a new text alignment to the group box. By default the text of a group box is in the upper left corner. The alignment can also be set to the right, although this is not commonly done.


The only argument is:


A text string that is either:


The group box label is aligned to the upper left.


The label is aligned to the upper right.


Changing the style is staightforward:

  gb = self~getGroupBox(IDC_GB_AREACODES)
  if gb == .Nil then return