Subject: | Tk::Menu Options Problem |
I can not seem to get the options to work on the Menu widget using the
following command: $menu = $parent->Menu(?options?);
Module: Tk-804.029
Perl Version: 5.10.0 (ActiveState)
Operating System: Windows XP, SP3.
I'm trying to create a simple menu at the top of my MainWindow, except
I'd like it to have a different font and background color. I've added my
options to the Menu itself but this seems to have no effect on the menu.
I can add the option to the individual menu items and this works,
unfortunately you can not add options to a "separator" item (that part
is documented on CPAN).
Code:
-------------------------------------------------------
my $mw = MainWindow->new();
my $menuBar = $mw->Menu( -font=> "{Sans} 14 bold", -background=> 'green' );
$mw->configure( -menu=> $menuBar );
my $fileMenu = $menuBar->cascade( -label=> "File" );
$fileMenu->command( -label=> 'Open' );
$fileMenu->command( -label=> 'Save', -font=> "{Sans} 14 bold",
-background=> 'green' );
$fileMenu->separator;
$fileMenu->command( -label=> 'Exit', -command=> \&exit );
MainLoop();
-------------------------------------------------------
I've checked on a couple of Perl forums and was told that the options
work fine on Unix or Mac environments.
Thank you for your time.
Subject: | menu.pl |
#!perl -w
use strict;
use warnings;
use Tk;
my $mw = MainWindow->new();
my $menuBar = $mw->Menu( -font=> "{Sans} 14 bold", -background=> 'green' );
$mw->configure( -menu=> $menuBar );
my $fileMenu = $menuBar->cascade( -label=> "File" );
$fileMenu->command( -label=> 'Open' );
$fileMenu->command( -label=> 'Save', -font=> "{Sans} 14 bold", -background=> 'green' );
$fileMenu->separator;
$fileMenu->command( -label=> 'Exit', -command=> \&exit );
MainLoop();
1;
__END__