in reply to Tk menu Apple macOS
I don't have an answer for you but I can confirm what you're seeing. I also ran some additional tests. I'm using: macOS Sierra 10.12.5; Perl 5.28.0; Tk 804.034; XQuartz 2.7.11; and, xorg-server 1.18.4.
Firstly, for all tests, I wrapped the code you posted in:
#!/usr/bin/env perl use strict; use warnings; use Tk; my $mw = MainWindow::->new(); ... MainLoop;
[It's best to show code that can be run directly. It makes it easier for us to test. It also means that a potential problem, in the code you haven't shown, can be detected. SSCCE has more about this.]
With your code, I see a ".apple" menu button which has an empty dropdown list. The system (apple-icon) menu is unchanged.
I added this line (after "my $applemenu = ..."):
$applemenu->command(-label => 'Hello', -command => sub { print "Hello\ +n" });
The ".apple" dropdown list now has this item which works as expected. Again, the system (apple-icon) menu is unchanged.
I also tried without the toplevel:
my $menubar = $mw->Menu(-type => 'menubar'); ... $mw->configure(-menu => $menubar);
This also works for the ".apple" menu; but the system (apple-icon) menu is still unchanged.
I'll front-page your post to give it a wider audience as I'd anticipate reduced attendance over the next few days. I'm also personally interested in an answer to this. [Update: haukex front-paged it while I was composing my reply.]
Finally, just as a side note, Perl's Tkx and Tk are both based on tcl/tk. Tkx is just a thin wrapper around it. Tk uses code based on it; for example, see the first line of the Tk::Menu source:
# Converted from menu.tcl --
Although both have superficial similarities in various places, they are quite different. As a quick example:
$mw->Button(...)->pack; # Tk $mw->new_button(...)->g_pack; # Tkx
— Ken
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tk menu Apple macOS
by chrstphrchvz (Scribe) on Jan 18, 2019 at 20:53 UTC | |
by kcott (Archbishop) on Jan 21, 2019 at 06:26 UTC | |
|
Re^2: Tk menu Apple macOS
by Anonymous Monk on Dec 23, 2018 at 10:26 UTC |