0

I have problem with WinAPI radio buttons. Basically I have three of them and when I switch from one to another the old one is still checked until I hover mouse over it or I click again the button I clicked before. I tried with invalidating both - controls and the whole window - with no luck. I have similar issue with checkboxes in the same dialog - I must hover over them to see their actual state.

EDIT:

This is done when each button is selected (note 1011 ... 1013 are radio buttons IDs):

RECT rect;
BringWindowToTop(GetDlgItem(hwnd, 1011));
GetClientRect(GetDlgItem(hwnd, 1011), &rect);
InvalidateRect(GetDlgItem(hwnd, 1011), &rect, TRUE);
RedrawWindow(GetDlgItem(hwnd, 1011), &rect, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);

BringWindowToTop(GetDlgItem(hwnd, 1012));
GetClientRect(GetDlgItem(hwnd, 1012), &rect);
InvalidateRect(GetDlgItem(hwnd, 1012), &rect, TRUE);
RedrawWindow(GetDlgItem(hwnd, 1012), &rect, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);

BringWindowToTop(GetDlgItem(hwnd, 1013));
GetClientRect(GetDlgItem(hwnd, 1013), &rect);
InvalidateRect(GetDlgItem(hwnd, 1013), &rect, TRUE);
RedrawWindow(GetDlgItem(hwnd, 1013), &rect, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASE);

I also tried sending WM_PAINT message and call UpdateWindow() on both - whole window and each radio button - no effect.

  • Show what you've try .. – matzone May 17 '13 at 07:39
  • 1
    All radio buttons must have `WS_TABSTOP` and the *first* must also have `WS_GROUP` style otherwise the auto-selection will not work. See here - http://stackoverflow.com/a/13550187/2065121 – Roger Rowland May 17 '13 at 07:42
  • Using visual editor (these guys aren't created using CreateWindowEx()) I changed in properties of each "Tabstop" value to true and "Group" value to true as well for the first radio button. Sadly nothing changes. – user1694627 May 17 '13 at 08:07

0 Answers0