CDialog and tab key
-
I have a dialog with some buttons and MFC GridCtrl's. When the focus is on the last cell of the grid and the tab key is pressed, I want to set the focus to the next control. How do you do this? I have played around with the GetDlgCode() etc. but haven't really been able to get this working.
-
I have a dialog with some buttons and MFC GridCtrl's. When the focus is on the last cell of the grid and the tab key is pressed, I want to set the focus to the next control. How do you do this? I have played around with the GetDlgCode() etc. but haven't really been able to get this working.
Have you tried SetFocus() ???? Best Wishes, ez_way
-
Have you tried SetFocus() ???? Best Wishes, ez_way
I think I haven't explained myself correctly. What I need to know is where to catch the tab key and set the focus to the next control. Normally (e.g. with buttons etc.) the dialog seems to handle this.
-
I think I haven't explained myself correctly. What I need to know is where to catch the tab key and set the focus to the next control. Normally (e.g. with buttons etc.) the dialog seems to handle this.
Hi Brian Please don't yell for a stupid idea but the tab order you set with CTRL+D shows the tabs,... yes? Well with that in mind can you not set focus whereever you wish? I know this is really not a great answer but it worked for me in a tabbed prj. Best Wishes, ez_way
-
I have a dialog with some buttons and MFC GridCtrl's. When the focus is on the last cell of the grid and the tab key is pressed, I want to set the focus to the next control. How do you do this? I have played around with the GetDlgCode() etc. but haven't really been able to get this working.
Oh yes, one more thing when you set the focus please make sure to note the overload function. SetFocus(GetDlgItem(hDial, ID_VERT_RES)); Best Wishes, ez_way
-
Hi Brian Please don't yell for a stupid idea but the tab order you set with CTRL+D shows the tabs,... yes? Well with that in mind can you not set focus whereever you wish? I know this is really not a great answer but it worked for me in a tabbed prj. Best Wishes, ez_way
Martin, thanks for your reply, but that will not work for me as my controls are dynamically created.
-
I have a dialog with some buttons and MFC GridCtrl's. When the focus is on the last cell of the grid and the tab key is pressed, I want to set the focus to the next control. How do you do this? I have played around with the GetDlgCode() etc. but haven't really been able to get this working.
Yes sure but what about using TRY/CATCH to do the validation? Best Wishes, ez_way
-
Yes sure but what about using TRY/CATCH to do the validation? Best Wishes, ez_way
:confused:
-
:confused:
Validating control contents when switching focus from one control to the next is done by handling the EN_KILLFOCUS notification sent by the edit control that is losing focus. You could trap TRY/CATCH this and send it along the way in a altered state! Best Wishes, ez_way