home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / auto / Tk / Menu / Invoke.al < prev    next >
Encoding:
Text File  |  1997-08-10  |  720 b   |  34 lines

  1. # NOTE: Derived from ..\blib\lib\Tk\Menu.pm.  Changes made here will be lost.
  2. package Tk::Menu;
  3.  
  4. # Invoke --
  5. # This procedure is invoked when button 1 is released over a menu.
  6. # It invokes the appropriate menu action and unposts the menu if
  7. # it came from a menubutton.
  8. #
  9. # Arguments:
  10. # w - Name of the menu widget.
  11. sub Invoke
  12. {
  13.  my $w = shift;
  14.  my $type = $w->type("active");
  15.  if ($w->typeIS("active","cascade"))
  16.   {
  17.    $w->postcascade("active");
  18.    $menu = $w->entrycget("active","-menu");
  19.    $menu->FirstEntry() if (defined $menu);
  20.   }
  21.  elsif ($w->typeIS("active","tearoff"))
  22.   {
  23.    $w->Unpost();
  24.    $w->TearOffMenu();
  25.   }
  26.  else
  27.   {
  28.    $w->Unpost();
  29.    $w->invoke("active")
  30.   }
  31. }
  32.  
  33. 1;
  34.