Delphi Tips&Tricks News   Tips   .NET Software   VCL Software   Search   Contacts
Ultimate Pack - special offer!

Ultimate Pack  hot!
Image Editor  new!
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET

...get more...
for Delphi.NET, C#, VB.NET
for Delphi VCL, BCB 3-6

WinAPI Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com
cdtrrracks.com new!

Blogspot  greatis.blogspot.com

Create PopUp menu inside other PopUp - Components - Tips & Tricks - Greatis Delphi Pages

Use Insert method for adding SubPopupItem to a PopUp menu.


procedure TForm1.MyShow(Sender: TObject);
begin
  with Sender as TMenuItem do ShowMessage(Caption);
end;

procedure TForm1.First1Click(Sender: TObject);
var
  MyPopUpItems: array[0..2] of TMenuItem;
  i: Integer;
begin
  for i:=0 to 2 do
  begin
    MyPopUpItems[i]:=TMenuItem.Create(Self);
    MyPopUpItems[i].Caption:='New item '+IntToStr(i);
    PopupMenu1.Items[1].Insert(i, MyPopupItems[i]);
    MyPopUpItems[i].OnClick:=MyShow;
  end;
end;
Related topics
Add a MenuItem to a menu dynamically

For more
Delphi Help

Download source