Please enable JavaScript to view this site.

A-Shell Reference

A groupbox is a hollow rectangle with rounded corners used to group a collection of related control. In the following sample, the three buttons are grouped within a groupbox titled "Test Group."

ashref_img104

The controls belonging to the groupbox must specify the groupbox ctlid as their parent when they are created, and their coordinates are relative to the upper left corner of the groupbox.

Groupboxes are useful in several ways:

They provide visual organization.
The fact that the child controls use relative coordinates allows you to adjust the position of the entire group by changing the position of the groupbox.
The AUI_EVENTWAIT class allows the user to move among the buttons within a group, providing a simple way to wait for one of a group of option buttons.
Grouping controls together using a groupbox allows them all to be deleted in a single step by deleting the groupbox.
Groupboxes are needed to define more than one set of radio buttons.

Groupboxes do not have to be visible to offer all of the above features (except for the first one). Also, the child controls do not have to be confined geometrically within the groupbox. The groupbox above would work just as well if the box were invisible, and even if it was reduced to a one by one block in the upper left corner. Also, child controls may be placed on top of the border (whether visible or not). These facts come in handy when you want to have a group of buttons for control purposes, but you do not want to waste any screen space for it. For example, you can make the groupbox invisible and one row high, then put a row of buttons on that same row. Or, another common arrangement is to put a row of buttons at the bottom of a window, with just a line above it:

ashref_img105

In the example above, an invisible group was probably created, occupying the bottom two rows of the screen. On top of the invisible group, a single line was drawn (see Lines, Rectangles and Frames), along with the buttons below it. BTNMNU.SBX can be used to create groups of buttons like this.)

A groupbox one row high still contains 4 sides, so if you want a single line like in the above example, you have to use the rectangle technique.

Subtopics

Groupbox + MBF_ALTPOS