-
October 31st, 2007, 06:08 AM
#1
[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
-
October 31st, 2007, 08:23 AM
#2
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();
Nobody cares how it works as long as it works
-
October 31st, 2007, 09:57 AM
#3
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??
-
October 31st, 2007, 10:50 AM
#4
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
Nobody cares how it works as long as it works
-
October 31st, 2007, 11:05 AM
#5
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
-
October 31st, 2007, 12:33 PM
#6
Re: Radio Button problem with WM_NEXTDLGCTL
Crystal clear, isn't it
You're welcome !
Nobody cares how it works as long as it works
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|