Why is groupbox a button in Win32 API? (BS_GROUPBOX)

aoyama 1 Reputation point
2020-08-07T14:10:07.663+00:00

In Win32 API we create a groupbox with BS_GROUPBOX, where BS stands for button style and there are BS_PUSHBUTTON, BS_RADIOBUTTON, BS_CHECKBOX, BS_3STATE etc. Pushbutton, radiobutton, checkbox and 3-state checkbox are really buttons, but how can a groupbox becomes a button? There seems not anything in common. For me I would rather call it a static.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,498 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rita Han - MSFT 2,161 Reputation points
    2020-08-10T02:46:42.047+00:00

    Hello,

    A group box is a rectangle that surrounds a set of controls, such as check boxes or radio buttons, with an application-defined text label in its upper left corner. The sole purpose of a group box is to organize controls related by a common purpose (usually indicated by the label). The group box has only one style, defined by the constant BS_GROUPBOX. Because a group box cannot be selected, it has no check state, focus state, or push state.

    Group box control can be created from the BUTTON class by using the CreateWindowEx function. It has the BS_GROUPBOX, WS_CHILD, and WS_GROUP styles.

    Refer to Button Types.

    So it is a type of Button by design.

    Thank you!

    0 comments No comments