It turns out the height of the menubar window was manually being set to 30 using $toplevel->geometry. Having it use height 0 instead eliminates the empty space. I then have to tell the program separately to pretend the menubar window has a height of 30 so that the positions calculated for the other windows do not overlap with the menubar window. Since I'm using geometry anyways, I can omit the spacer widget. Here's what that looks like for the test program:
use warnings;
use strict;
use Tk 800.000;
my $mw = MainWindow->new;
my $menu = $mw->Menu();
my $file_menu = $menu->cascade(-label => 'File', -tearoff => 'false');
my $edit_menu = $menu->cascade(-label => 'Edit', -tearoff => 'false');
my $help_menu = $menu->cascade(-label => 'Help', -tearoff => 'false');
$mw->configure(-menu => $menu);
# same effect as geometry('200x0+0+0')
#my $spacer = $mw->Frame(-width => 200)->pack;
$mw->geometry('200x0+0+0');
# resize handle obscures Help menu
$mw->resizable(0,0);
MainLoop;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|