Tk Source Code

View Ticket
Login
Ticket UUID: 220865
Title: Windows/Unix discrepancy, Toplevel -width/-height/-menu
Type: Bug Version: obsolete: 8.2
Submitter: welch Created on: 2000-11-01 01:32:09
Subsystem: 65. Generic Window Operations Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Open Last Modified: 2003-11-13 17:04:09
Resolution: None Closed By:
    Closed on:
Description:
OriginalBugID: 2722 Bug
Version: 8.2
SubmitDate: '1999-09-10'
LastModified: '2000-01-17'
Severity: MED
Status: UnAssn
Submitter: techsupp
ChangedBy: hobbs
RelatedBugIDs: 3185
OS: Windows 95
Machine: X86


Name:
Hume Smith

ReproducibleScript:
toplevel .x -menu .x.menuBar -width 400 -height 300
    menu .x.menuBar
    
    toplevel .y -width 400 -height 300

ObservedBehavior:
On unix, the windows are the same size*
    On Windows'95, .x shrinks to the size of the menubar
    
    (* I hope - I haven't tried this exact code.  It's really Quill's
    windows that behave differently, and it appears to be the -menu option
    that causes the difference.)

DesiredBehavior:
I expect the same behaviour on '95 and X... I want both windows the same
    size, as on X
User Comments: vincentdarley added on 2001-12-18 17:58:09:
Logged In: YES 
user_id=32170

Here's another example, with a workaround:

    menu .menubar
    wm title . "Alphatk"
    . configure -menu .menubar
    menu .menubar.help -tearoff 0
    .menubar add cascade -menu .menubar.help -label "Help"

    # This looks rather confused.  The idea is to generate 
a long thin
    # window across the top of the screen, containing the 
Tk menu
    # bar.  However some unix systems include the height of 
the menu
    # bar in '.', so settings its height to 0 is very 
bad... we don't
    # get any menus!  Also we somehow need a bunch of 
updates etc, so
    # that this works on different versions of WinTk (there 
have been
    # a number of behavioural changes in the wm code of 
8.2.x-8.3.x).
    # 
    # Anyway, I think it works for all platforms now!
    wm geometry . +0+0
    frame .dummy -height 0 -width [winfo screenwidth .]
    pack .dummy
    update
    wm geometry . +0+0
    update
    destroy .dummy

We had to use a dummy frame to get the same desired 
behaviour on unix and windows.  Surely this code should be 
as simple as:

    menu .menubar
    . configure -menu .menubar
    wm geometry . [winfo screenwidth .]x[winfo reqheight .]
+0+0

But that won't work properly on all platforms (any 
platforms?).  Even worse, if we repeat these two lines:

% .menubar add cascade -label foo
% wm geometry . [winfo screenwidth .]x[winfo 
reqheight .menubar]+0+0

over and over, the height of the '.' window grows each 
time!  I guess this means that 'winfo reqheight .menubar' 
is the wrong thing to use.  Anyway, some consistency needs 
to be applied to menubar geometry handling across the 
various platforms.