Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Howdy, Monks!

Recently I've been trying to get a Perl/Tk program (HSW12, an IDE for programming microcontrollers) working with Tcl::pTk::TkHijack. One reason for doing so is letting the program be run on macOS using the native aqua UI instead of XQuartz. (Here's the full story on GitHub.)

One step I've taken is adapting the menubar to use the Tk 8 menu (cf. Mastering Perl/Tk - "12.2 Menubars and Pulldown Menus") rather than by packing Menubuttons. That way the native menubar at the top of the Mac's screen gets used instead of a menu in a window. However, the layout of the program has been such that the menubar is in its own window. When using the Tk 8 menu on non-Mac aqua, there is now a small amount of extra space (about 30 pixels vertically); and because there are no other widgets in the window, there doesn't appear to be anything to e.g. pack and remove the extra space. (See the bottom of this GitHub comment for a screenshot.)

Any ideas for how to remove this empty space/a way to force "pack" without widgets?

Some things I've already tried: I haven't found a suitable dummy widget that will shrink beyond some minimum size ≫0 (again, roughly 30 pixels). I thought I might set the toplevel's maxheight to the height of the menu, but I haven't found where that can be retrieved (the width and height of the menu is always 1x1 according to $menu->geometry). I'd rather not hardcode a height because the menu's height varies by platform and user theming/customizations.

Of course, one workaround would be to only use the Tk 8 menubar if running on Mac aqua (hiding the now-empty window using withdraw), and use the packed Menubuttons otherwise. One day I might use a module like Tk::IDElayout (compare to dock windows/panels in newer UI toolkits) which can let everything reside in a single toplevel window by default.


In reply to Using Tk 8 menubar in its own window by chrstphrchvz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-24 12:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found