How to setup multiple radio button groups for proper tab-order and keyboard interaction (WIN32)?
Contrary to popular opinion, you do NOT need an groupbox control, or any other such outer "container" (which a groupbox isn't anyway, its just a button artifact). The following describes how you can do this with no requirement of a group-box. If you want a group box that functionally assists in the layout described here, forward down to the EDIT portion of this answer, where I explain how the OP's specific desires can be achieved.
Auto-Radio button "banks" work by using two key window style attributes, WS_GROUP, and WS_TABSTOP. Do the following for your two "banks" which I will affectionately called Bank1 and Bank2:
Bank 1: the first radio button should have both WS_GROUP | WS_TABSTOP in the control style. the remaining radio buttons should have neither of those, and must be in sibling order (meaning in DIALOG script they immediately follow each other; in dynamic creation they are created sequentially).
The first child control after your last radio button in Bank1 should have at least WS_GROUP style, and WS_GROUP | WS_TABSTOP if it is a tab-stopped control.
Bank 2: the first radio button should have both WS_GROUP | WS_TABSTOP in the control style. the remaining radio buttons should have neither of those, and must be in sibling order (meaning in DIALOG script they immediately follow each other; in dynamic creation they are created sequentially).
The first child control after your last radio button in Bank2 should have at least WS_GROUP style, and WS_GROUP | WS_TABSTOP if it is a tab-stopped control.
Layout like the above allows you to "tab" to a radio button bank, and use the arrow keys to switch selections. You then "tab" again to leave that bank and head to the next tab-stop. Remember, the dialog manager will always move to the next WS_TABTOP child control when you hit Tab (or prior with Shift-Tab). If the control being hopped to is an auto-type the control selected will be the 'selected' control within the most recent WS_GROUP.
If it helps, grab a sketch pad, draw it on paper, and stick a "T" on the tab-stops and a "G" on the group attributes as described above. It will probably be much clearer once visualized. Look at a dialog resource script to see how these work together for more insight.
Notes: If you want to use group boxes surrounding these you can. The dialog manager works by associating controls to groups based on the last control that was flagged with WS_GROUP, and the first control thereafter that has WS_TABSTOP is considered the tab-jump-in point for that group. Inserting a Groupbox first (which can't be a tabstop) followed by the radio button controls with WS_TABSTOP on the first radio button (no WS_GROUP this time), will also work. I generally find it easier to just arrange my radio buttons without dependence on groupboxes.
EDIT A Picture Speaks a Thousand Words
For your picture I would probably create the following children in the following order:
- "Icon" groupbox, including WS_GROUP style.
- "Information" auto-radio button, including WS_TABSTOP
- All other "Icon" group radio buttons. Do NOT include WS_TABSTOP or WS_GROUP.
- "Button" groupbox, including WS_GROUP style. This closes the current control group and start the next.
- "AbortretryIgnore" auto-radio button, including WS_TABSTOP
- All other "Button" group radio buttons. Do NOT include WS_TABSTOP or WS_GROUP.
- The next control after the "Button" radio buttons must include WS_GROUP. This closes the current control group and starts the next.
Obviously all the other child control styles, visibility, etc need to be used correctly as well, and of course the children should all have unique ids. I'm assuming you already have the rest of that covered.