function MenuAddMainItem( aForm : tForm; aPopUpMenu : TPopUpMenu; aEnabled, aVisible : integer; aCaption, aHint :
string; aImageIndex : integer; aOnClickEvent : TNotifyEvent; aAction : TAction; aShortCut :
string ) : TMenuItem;
var xMI : TMenuItem;
begin
with aPopUpMenu
do begin
xMI := TMenuItem.Create( aForm );
Result := xMI;
with xMI
do begin
enabled := aEnabled = 1;
visible := aVisible = 1;
caption := aCaption;
hint := aHint;
imageIndex := aImageIndex;
onClick := aOnClickEvent;
shortCut := TextToShortCut( aShortCut );
action := aAction;
end;
Items.Add( xMI );
end;
end;
function MenuAddSubItem ( aForm : tForm; aItemParent : TMenuItem; aEnabled, aVisible : integer; aCaption, aHint :
string; aImageIndex : integer; aOnClickEvent : TNotifyEvent; aAction : TAction; aShortcut :
string ) : TMenuItem;
var xMI : TMenuItem;
begin
xMI := TMenuItem.Create( aForm );
Result := xMI;
with xMI
do begin
enabled := aEnabled = 1;
visible := aVisible = 1;
caption := aCaption;
hint := aHint;
imageIndex := aImageIndex;
onClick := aOnClickEvent;
shortCut := TextToShortCut( aShortCut );
action := aAction;
end;
aItemParent.Add( xMI );
end;
procedure TMV.FormCreate( Sender : TObject );
var
// Max Tiefe 5 Menu Ebenen
xMi1, xMi2, xMi3, xMi4, xMi5 : TMenuItem;
begin
// 2017.04.11.uc - Workaround PopUpMenu verliert Einträge
// (pop3 ist im form definiert und zugeordnet)
xMi1 := MenuAddMainItem( self,
Pop3, 1, 1, '
Intern' , '
-' , 22 ,
nil ,
nil, '
' );
xMi2 := MenuAddSubItem ( self, xMi1, 1, 1, '
Adressanschrift', '
Adresse' , 98 , A_Vari,
nil, '
' );
xMi2 := MenuAddSubItem ( self, xMi1, 1, 1, '
Adresszeile' , '
Zeile' , -1 , A_Vari,
nil, '
' );
xMi2 := MenuAddSubItem ( self, xMi1, 1, 1, '
Brief' , '
Brief' , -1 , A_Vari,
nil, '
' );
xMi2 := MenuAddSubItem ( self, xMi1, 1, 1, '
Adresse' , '
' , -1 ,
nil ,
nil, '
' );
xMi3 := MenuAddSubItem ( self, xMi2, 1, 1, '
Anrede' , '
Anrede' , -1 , A_Vari,
nil, '
' );
xMi3 := MenuAddSubItem ( self, xMi2, 1, 1, '
Vorname' , '
VorName' , -1 , A_Vari,
nil, '
' );
xMi3 := MenuAddSubItem ( self, xMi2, 1, 1, '
Name/Firma' , '
NachName', -1 , A_Vari,
nil, '
' );
xMi2 := MenuAddSubItem ( self, xMi1, 1, 1, '
-' , '
' , -1 ,
nil ,
nil, '
' );
end;