unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, VistaMenu;
type
TForm1 =
class(TForm)
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
FVistaMenu : TVistaMenu;
procedure MenuFileOpen(Sender:TObject);
procedure MenuFileQuit(Sender:TObject);
procedure MenuEditCut(Sender:TOBject);
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
item, item1 : TMenuItem;
begin
FVistaMenu := TVistaMenu.Create(self);
FVistaMenu.MenuStyle := msVistaOrange;
// File
item := TMenuItem.Create(self);
with item
do begin
Caption := '
File';
end;
FVistaMenu.Items.Add(item);
item1 := TMenuItem.Create(self);
with item1
do begin
Caption := '
Open';
OnClick := MenuFileOpen;
end;
item.Add(item1);
item1 := TMenuItem.Create(self);
with item1
do begin
Caption := '
Quit';
OnClick := MenuFileQuit;
end;
item.Add(item1);
// Edit
item := TMenuItem.Create(self);
with item
do begin
caption := '
Edit';
end;
FVistaMenu.Items.Add(item);
item1 := TMenuItem.Create(self);
with item1
do begin
Caption := '
Cut';
OnClick := MenuEditCut;
end;
item.Add(item1);
// etc.
end;
procedure TForm1.MenuFileOpen(Sender:TObject);
begin
ShowMessage('
File / Open clicked');
end;
procedure TForm1.MenuFileQuit(Sender:TObject);
begin
Close;
end;
procedure TForm1.MenuEditCut(Sender:TObject);
begin
ShowMessage('
Edit / Cut clicked');
end;
end.