9.17. How do I obtain Menus that do not tear off?

Nick Ing-Simmons outlined a couple of ways to achieve this result. The critical feature being the -tearoff => 0 configuration option of the Menu. In Nick's words:

    my $mb = $parent->Menubutton(...);    # The button
    my $menu = $mb->Menu(-tearoff => 0);  # Create a non-tearoff menu
    $mb->configure(-menu => $menu);       # Tell button to use it.
    $mb->command(....);
Above is for clarity - you can loose $menu variable:
    my $mb = $parent->Menubutton(...);  
    $mb->configure(-menu => $mb->Menu(-tearoff => 0));  
    $mb->command(....);

Previous | Return to table of contents | Next