How to change frame / window focus programatically - after using SetWindowPos
-
I have constructed two property sheet frames and need to switch (programatically)between them. I can change the Z order and bring the hidden frame to the top using SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE| SWP_NOACTIVATE ); The "problem" is that the original frame still has a focus. When I use SetFocus the new frame gets hidden again. ActivateFrame produces same result. Is there any other way to accomplish this? Any constructive help is as always appreciated. Thanks Vaclav
-
I have constructed two property sheet frames and need to switch (programatically)between them. I can change the Z order and bring the hidden frame to the top using SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE| SWP_NOACTIVATE ); The "problem" is that the original frame still has a focus. When I use SetFocus the new frame gets hidden again. ActivateFrame produces same result. Is there any other way to accomplish this? Any constructive help is as always appreciated. Thanks Vaclav
-
Yes, it does not work at all without it. The windows stays in its Z position , therefore behind the top window of interest.The MSDN explanation of function of SWP_NOACTIVATE is not written in English. I'll try to get rid of the frame caption / title to see if it works without it( I need it for now to keep track of the property sheets) , but I am busy working on something else now. Thanks for reply. Vaclav
-
I have constructed two property sheet frames and need to switch (programatically)between them. I can change the Z order and bring the hidden frame to the top using SetWindowPos(&CWnd::wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE| SWP_NOACTIVATE ); The "problem" is that the original frame still has a focus. When I use SetFocus the new frame gets hidden again. ActivateFrame produces same result. Is there any other way to accomplish this? Any constructive help is as always appreciated. Thanks Vaclav
Have you considered actually hiding the hidden window: CWnd::ShowWindow( SW_HIDE )? Then it can't have focus and can't be accidentally displayed.
Please do not read this signature.
-
Have you considered actually hiding the hidden window: CWnd::ShowWindow( SW_HIDE )? Then it can't have focus and can't be accidentally displayed.
Please do not read this signature.
No, since it is build as second property sheet it is already hidden. Seems redundant to do so, but I'll give it a shot. The "problem" is that I can show this window by changing the Z order. But since it is not covering the original property sheet window ( by design) , the user can click in its tabs and "nothing" will happend since the window on top of the Z order is active but without focus! So to get back to the "main" tab, the user need to click on the top tab (Z order) and than the main tab see it as active dialog and can operate normally. Vaclav