RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TPopupMenu.Popup Method

Displays the pop-up menu onscreen.

Pascal
procedure Popup(X: Integer; Y: Integer); virtual;
C++
virtual __fastcall Popup(int X, int Y);

Call Popup to bring up the pop-up menu. The menu appears at the screen coordinates indicated by the values (in pixels) of X and Y.  

C++ Examples: 

 

/*
This example uses a pop-up menu. When the user presses the
mouse button, the pop-up menu appears where the user
clicked the mouse:
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
  PopupMenu1->AutoPopup = false;
}

void __fastcall TForm1::FormMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
          int X, int Y)
{
  PopupMenu1->Popup(Left + X, Top + Y);
}

 

Delphi Examples: 

{
This example uses a pop-up menu. When the user presses the
mouse button, the pop-up menu appears where the user
clicked the mouse:
} 
procedure TForm1.FormCreate(Sender: TObject);
begin
  PopupMenu1.AutoPopup := False;
end;

procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  PopupMenu1.Popup(Left + X, Top + Y);
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!