Does WS_TABSTOP works on CWnd classes?
-
Hi. I have a bunch of controls dynamically created in a CWnd and i want to jump between them with the TAB. Just adding WS_TABSTOP to the dwstyle isnt working. Is it because i have to be in a CDialog or CFormView (parent)class? If so, is the best solution to emulate it by tracking the TAB button and using CWnd::GetNextDlgTabItem ? Other related question: how do i set the tab order in dynamic created controls? Creation order? Thanks in advance!
-
Hi. I have a bunch of controls dynamically created in a CWnd and i want to jump between them with the TAB. Just adding WS_TABSTOP to the dwstyle isnt working. Is it because i have to be in a CDialog or CFormView (parent)class? If so, is the best solution to emulate it by tracking the TAB button and using CWnd::GetNextDlgTabItem ? Other related question: how do i set the tab order in dynamic created controls? Creation order? Thanks in advance!
I think it should work with a CWnd. To set the tab order dynamically, call SetWindowPos, like this
pWindowBefore->SetWindowPos( pWindowAfter, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE );
where you want pWindowAfter to be the control that gets tabbed to when pWindowBefore has the focus and the user hits Tab. Creation order should set the initial tab order, so if you create your controls in the order that they should be tabbed between, you should be OK. If you are using a fully custom control, there's some wierd issues with focus (like needing to manually call SetFocus when you get a WM_LBUTTONDOWN). I can't really remember the specifics, but mess around with the SetFocus, and see where it takes you. Chris Richardson C/C++ Include Finder[^]