Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: Using Tk 8 menubar in its own window

by chrstphrchvz (Scribe)
on May 24, 2018 at 05:39 UTC ( #1215131=note: print w/replies, xml ) Need Help??


in reply to Re^2: Using Tk 8 menubar in its own window
in thread Using Tk 8 menubar in its own window

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;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1215131]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2022-09-25 17:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (116 votes). Check out past polls.

    Notices?