Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to change frame / window focus programatically - after using SetWindowPos

How to change frame / window focus programatically - after using SetWindowPos

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vaclav_
    wrote on last edited by
    #1

    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

    R A 2 Replies Last reply
    0
    • V 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

      R Offline
      R Offline
      Rozis
      wrote on last edited by
      #2

      is SWP_NOACTIVATE the problem?

      V 1 Reply Last reply
      0
      • R Rozis

        is SWP_NOACTIVATE the problem?

        V Offline
        V Offline
        Vaclav_
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • V 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

          A Offline
          A Offline
          Avi Berger
          wrote on last edited by
          #4

          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.

          V 1 Reply Last reply
          0
          • A Avi Berger

            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.

            V Offline
            V Offline
            Vaclav_
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups