[RESOLVED] Radio Button problem with WM_NEXTDLGCTL
Hi There!
I have the following Problem:
I have a dialog box with several text controls followed by two radio buttons for a selection. If i use the TAB key to jump from one input field to the next, the Text of the radio button wich has the focus is framed with a dotted rectangle, and the button can be checked with SPACE.
It is neccessar, that it is possible to switch between the controls also with ENTER. I do this by simply putting PostMessage(WM_NEXTDLGCTL,0,0) in OnOK().
Basically it works, and the behaviour is just like described above, but the frame arount the text of the radio buttons does not appear, so the user can not see wich button will be checked by pressing SPACE.
Any idea what i can to to make this frame appear???
Thanks in advance
Marc
Re: Radio Button problem with WM_NEXTDLGCTL
Try resetting the focus
Code:
CWnd *pWnd=GetFocus();
if(pWnd) {
SetFocus(NULL);
SetFocus(pWnd);
}
or it could be a repaint issue, in case this may help
or
or
Code:
pWnd->RedrawWindow();
Re: Radio Button problem with WM_NEXTDLGCTL
Thanks, but none of those did the trick!
I found out that the rectangles appear, if i press the TAB key at least once before i come to the radio buttons with ENTER. Really strange. Maybe i can simulate a TAB keystroke programmatically??
Re: Radio Button problem with WM_NEXTDLGCTL
OK, call this in OnInitDialog, OnInitialUpdate or whatever...
Code:
::PostMessage(m_hWnd, WM_UPDATEUISTATE, MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0);
Or, if you get an error that the constants are undefined:
Code:
::PostMessage(m_hWnd, 0x128, MAKEWPARAM(0x2, 0x1), 0);
More about WM_UPDATEUISTATE here:
http://msdn2.microsoft.com/en-us/library/ms646361.aspx
Re: Radio Button problem with WM_NEXTDLGCTL
Whatever that does,
Code:
::PostMessage(m_hWnd, 0x128, MAKEWPARAM(0x2, 0x1), 0);
works!
Thank you very much!!
Marc
Re: Radio Button problem with WM_NEXTDLGCTL
Crystal clear, isn't it :rolleyes:
You're welcome !