________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gary D Trosper Sent: Wednesday, January 10, 2007 9:20 PM To: Jack D Cc: 'Bill Luebkert'; perl-win32-users@listserv.ActiveState.com; [EMAIL PROTECTED] Subject: RE: Perl TK Graying out disabled menu items
>Tried that, >The menu item was disabled but not grayed out. >Also the menubar seems to begin at 1 instead of 0 for its items; so disabling 1 actually gets the 'File' menu. I think unless you explicitly state -tearoff=>0 - the first index is reserved for the tearoff line. I know that doesn't make sense for a menubar - but that is my guess anyways. My mistake! You said you wanted the **Edit** menu disabled. Easy - just increase the index to 2. It is documented that the "pattern" search for indices needed work, so I would just keep track of your index numbers and use them instead. Here is the full code again which grays out the "Edit" menu. It works as advertised on WinXP Home/AS Build 819 ... ############################################################################ use strict; use Tk; my %menus; my $mw = new MainWindow; $mw->geometry("+200+200"); $mw->minsize(400,300); my $menubar = $mw->Menu; $mw->configure(-menu => $menubar); foreach (qw/File Edit Help/) { $menus{$_} = $menubar->cascade(-label=>"~$_",-tearoff=>0); } $menus{'File'}->command(-label => "~New file"); $menus{'File'}->command(-label => "~Save file"); $menus{'File'}->command(-label => "E~xit", -command=>sub {$mw->destroy}); $menus{'Edit'}->command(-label=> "~Preferences"); $menus{'Edit'}->command(-label=> "File ~Editor"); $menus{'Help'}->command(-label=>"User ~Guide"); $menus{'Help'}->command(-label=>"~About"); $menubar->entryconfigure(2,-state=>'disabled'); MainLoop; ############################################################################ _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs