Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   OOP (https://www.clubdelphi.com/foros/forumdisplay.php?f=5)
-   -   Como peuedo añadir un item a un main menu??? (https://www.clubdelphi.com/foros/showthread.php?t=8299)

Roger 17-03-2004 10:18:18

Como peuedo añadir un item a un main menu???
 
Hola querria saber como añadir a un Tmainmenu items mediante comandos. Por ejemplo al presionar un boton del formulario.

__cadetill 17-03-2004 10:34:36

sacado de la ayuda del Delphi

Código:

procedure TForm1.Button1Click(Sender: TObject);
var
  NewItem: TMenuItem;
  I : integer;
begin
  { first create the separator }
  NewItem := TMenuItem.Create(Self);
  NewItem.Caption := '-';
  { add the new item to the Windows menu }
  Windows.Add(NewItem);
  { now create and add a menu item for each form }
  for  I := 0 to Screen.FormCount-1 do
  begin
    NewItem := TMenuItem.Create(Self);
    NewItem.Caption := Screen.Forms[i].Name;
    Windows.Add(NewItem);
  end;
end;



La franja horaria es GMT +2. Ahora son las 17:33:31.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi