From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gary D Trosper Sent: Wednesday, January 10, 2007 7:59 AM To: perl-win32-users@Listserv.ActiveState.com Subject: Perl TK Graying out disabled menu items Hi All, I'm running ActiveState perl version 5.8.0 built for MSWin32-86-multi-thread. I would like to create a simple menubar with some -command items disabled until programatical conditions are met. (No problem been there done that. Except that the button still takes focus and presses even though nothing happens) And I would like a visual cue ( letters grayed out) that the menu button/command is disabled. ( This is my PROBLEM ) I've tried using -disabledforeground => 'gray75' and get an error that -disableforeground is not a valid option. I've tried using both my $menuCmd = $menubar->command( yada-yada ); and my $menuCmd = $menubar->Menubutton( yada-yada); Same error so I used DataDumper to look at the return from $menuCmd->configure sure enough no -disabledforeground . ( I could have sworn both Learning and Mastering Perl/Tk listed -disabledforeground as an inherited option) So doing what any perlish person would do... I tried another way. I just tried to set the -foreground => 'gray75' No complaints this time just nothing happened. No color change in the lettering. Nothing. After hours of digging through documentation, experimentation, googling, and nose picking I have yet to come up with an answer. Then I saw the BUGS section on the ActiveState documentation on menu
"At present it isn't possible to use the option database to specify values for the options to individual entries." Does this mean I can't get there from here or is there some other arcane formulae that I am missing? Help me Mister Wizard! The following code "grays out" the exit button - and it is disabled too. I'm using the most recent version of Activestate perl. ############################################################################ 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"); my $m = $menus{'File'}->cget(-menu); $m->entryconfigure('last', -state=>'disabled'); MainLoop; ############################################################################ On a different note can anybody tell me what the -tiled and -disabledtile options do or are for? Can't find them documented anywhere I have never used either of them - but I recall that they didn't work on Windows. _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs