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

  1. # NOTE: Derived from ..\blib\lib\Tk\Menu.pm.  Changes made here will be lost.
  2. package Tk::Menu;
  3.  
  4. # tk_popup --
  5. # This procedure pops up a menu and sets things up for traversing
  6. # the menu and its submenus.
  7. #
  8. # Arguments:
  9. # menu - Name of the menu to be popped up.
  10. # x, y - Root coordinates at which to pop up the
  11. # menu.
  12. # entry - Index of a menu entry to center over (x,y).
  13. # If omitted or specified as {}, then menu's
  14. # upper-left corner goes at (x,y).
  15. sub Post
  16. {
  17.  my $menu = shift;
  18.  return unless (defined $menu);
  19.  my $x = shift;
  20.  my $y = shift;
  21.  my $entry = shift;
  22.  Unpost(undef) if (defined($Tk::popup) || defined($Tk::postedMb));
  23.  $menu->PostOverPoint($x,$y,$entry);
  24.  $menu->grabGlobal;
  25.  $Tk::popup = $menu;
  26.  $Tk::focus = $menu->focusCurrent;
  27.  $menu->focus();
  28. }
  29.  
  30. 1;
  31.