Tk Source Code

View Ticket
Login
Ticket UUID: 220114
Title: Window raise problem on NT
Type: Bug Version: obsolete: 8.2
Submitter: welch Created on: 2000-10-31 22:38:05
Subsystem: 68. Win Window Operations Assigned To: nobody
Priority: 2 Severity:
Status: Closed Last Modified: 2001-03-23 02:22:05
Resolution: Fixed Closed By: dgp
    Closed on: 2001-03-22 19:22:05
Description:
OriginalBugID: 792 Bug
Version: 8.0.4
SubmitDate: '1998-11-04'
LastModified: '1999-03-01'
Severity: MED
Status: Closed
Submitter: welch
ChangedBy: stanton
OS: All
OSVersion: NA
Machine: NA
FixedInVersion: NA
ClosedDate: '1999-03-01'


Seems I ran into a bug, err, an issue on Windows NT.

To test this, run this code on NT:



wm title . "NT Problem with raise"

button .quit -command exit -text "Quit"

pack .quit



set state 0

after 1000 toggle



proc toggle {} {

    global state



    if { $state } {

raise .

    } else {

lower .

    }



    set state [ expr ! $state ]

    after 1000 toggle

}



Now move make sure the winodw is covered by some other window

when it's lowered. Works beautifully, doesn't it? Now click

on the titlebar of the raising/lowering window and the one

that covers it. You should see that the window stops raising.

(I tried NT with SP1 and with SP3.)



Here is a patch that circumvents this behaviour by first

making the window a topmost (like the taskmanager) and then

cancelling that, which puts the window above all non-topmost

windows.



*** tkWinWindow.c.origThu Aug  6 03:20:06 1998

--- tkWinWindow.cFri Oct 30 15:48:20 1998

***************

*** 767,777 ****

      siblingHwnd = temp;

  }

      } else {

! siblingHwnd = (pos == Above) ? HWND_TOP : HWND_BOTTOM;

      }

  

      SetWindowPos(hwnd, siblingHwnd, 0, 0, 0, 0,

      SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);

  }

  

  /*

--- 767,782 ----

      siblingHwnd = temp;

  }

      } else {

! siblingHwnd = (pos == Above) ? HWND_TOPMOST : HWND_BOTTOM;

      }

  

      SetWindowPos(hwnd, siblingHwnd, 0, 0, 0, 0,

      SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);

+     if (siblingHwnd == HWND_TOPMOST) {

+       /* We do not really want a topmost. Move it down a little. */

+       SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0,

+  SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);

+     }

  }

  

  /*



03/01/1999 10:39 - stanton - This is the expected behavior.  Raise will raise windows within an application's window heirarchy.  If that application is active, then it will raise the window above all other windows.  If it is not active then Windows will not raise a window above the active application's windows.  The best way to achieve the user's desired behavior is to say:

focus -force .
raise .

This ensures that . is both the active window and at the top of the stacking order.