Tk Source Code

View Ticket
Login
Ticket UUID: 587698
Title: wm attributes -topmost and System Menu
Type: Bug Version: obsolete: 8.4b1
Submitter: wilkason Created on: 2002-07-28 14:16:39
Subsystem: 68. Win Window Operations Assigned To: chengyemao
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2002-08-08 07:29:06
Resolution: Duplicate Closed By: hobbs
    Closed on: 2002-08-08 00:29:06
Description:
Trying to use the new -topmost option of wm attributes, 
a typical application would be to post a new "Always on 
Top" menu option in the windows system menu (see 
code below). However, when running this code and 
selecting the "Always on Top" option, the menu choice 
disappears! If I replace the wm -topmost command with 
one from a custom dll that does the same thing, the 
menu option stays as expected.

There is some interaction with the topmost command 
and system menu.
#---Demo Code below ---------------------------------------
proc pinOnSystemMenu {M W} {
   if {$M=={}} {
      set M $W.menubar
      menu $M -tearoff 0
      $W config -menu $M
   }
   $M add cascade -label System -font menu -menu 
$M.system
   menu $M.system -tearoff 0
   set ::TA($W,pinned) 0
   $M.system add separator
   $M.system add checkbutton -label "Always on Top" \
      -variable ::TA($W,pinned) \
      -command "control $W \$::TA($W,pinned)"
}

proc control {win how} {
   wm attributes $win -topmost $how
}
proc state {win} {
   return [wm attributes $win -topmost]
}

wm withdraw .
toplevel .test
wm protocol .test WM_DELETE_WINDOW {exit}
;##
;# Play with system menu, the option will disappear 
when selected.
;#
pinOnSystemMenu {} .test
User Comments: hobbs added on 2002-08-08 07:29:06:
Logged In: YES 
user_id=72656

This has nothing to do with -topmost - it is actually a dup of 
220781, where system menus aren't maintained when the Tk 
wrapper window changes.