Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Items To Dinamic TMainMenu ? 1

Status
Not open for further replies.

Spent

Programmer
Mar 20, 2003
100
BG
Can you tell me how to add items to TMainMenu.I have this structure
File Edit Modules
How can i add items to the modules menu dinamicaly when I run the application
Thank You !

Spent
mail:spentbg@yahoo.com
 
Hi,

You can try something like this (adds 4 new sub menu items to the 3rd menu item across)...

Code:
var
  NewMenuItem : TMenuItem;
  i : integer;

begin
  for i := 1 to 4 do
  begin
    //Create new menu item
    NewMenuItem := TMenuItem.Create(Self);
    //set caption
    NewMenuItem.Caption := 'New Item' + IntToStr(i);
    //add as new item to 3rd menu item
    MainMenu1.Items[2].Add(NewMenuItem);
  end
end;

Hope this points in the right direction.



There are two ways to write error-free programs; only the third one works.
 
That is just what I was looking for.Thanks GHolden.I think a star is yours.

Spent
mail:spentbg@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top