Results 1 to 4 of 4

Thread: Window Focus

  1. #1
    Star Lounger
    Join Date
    Dec 2003
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Window Focus

    Hi all,

    I have a theory question today:
    1) How does Microsoft Windows decide which window gets the focus when a window is closed?
    2) How do other windowing systems decide which window gets the focus when a window is closed?

    (Please advise, can I also post this question on the Linux board, or is cross-posting frowned on here? I can't find any mention in the FAQ or help...)

    Thanks,
    Saturn

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Window Focus

    1) Roughly speaking, when you close a window, the window that had the focus before the window you just closed regains the focus. There are exceptions: an application may decide to push another window to the front. For example:
    - Start Word.
    - From Word, start the Visual Basic Editor (VBE)
    - Start Excel.
    - Use Alt+Tab to switch to Word's VBE.
    - Close the VBE.
    - Instead of Excel (the window that had the focus before), Word now gets the focus.

    2) No idea, but I guess it would be similar.

  3. #3
    Star Lounger
    Join Date
    Dec 2003
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Window Focus

    Hans,

    Are you saying that when I am in Window A, and I open Window B, when I close Window B, Window A gets the focus, unless Window B is a child of Window B', in which case Window B' gets the focus?

    Is it really that simple?

    -Saturn

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Window Focus

    I think the "unless" part is valid only if the application behind Window B' actively grabs the focus. There are also situations in which focus returns to Window A, even if Window B belonged to an application whose main window is behind Window A.
    So most of the time, it is a simple "last-in, first-out" stack, like the stack of plates or trays in a self-service restaurant.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •