in reply to how to disable a menuitem at runtime

$ragimenu->Menubutton(-state=>'disabled');

One world, one people

Replies are listed 'Best First'.
Re^2: how to disable a menuitem at runtime
by arunmep (Beadle) on Jul 21, 2005 at 10:11 UTC
    use Tk;
    $main=MainWindow->new;
    $menubar=$main->Frame->pack(-side=>'top',-fill=>'x');
    $ragimenu= $menubar->Menubutton(-text=>'Ragi')->pack(-side=>'left');
    $ragimenu->command(-label=>'History',-command=>\&history);
    $searchbar=$menubar->Menubutton(-text=>'Search')->pack(-side=>'left');
    $searchbar->command(-label=>'Literature search',-command=>\&literature);
    $searchbar->command(-label=>'Genome search',-command=>\&genome);
    sub history
    {
    $test=$main->Entry->pack();
    $ragimenu->Menubutton(-state=>'disabled');
    }
    MainLoop;
    i have tried by placing the $ragimenu->Menubutton(-state=>'disabled');
    but that to does't works it still active
      Unfortunately I can't install Tk.pm in the office, so I am flying blind here. But the next thing I would try is moving that line into the main loop, instead of in the history subroutine.

      One world, one people