RAD Studio VCL Reference
|
Lists the menu items in the submenu of the menu item.
property Items [Index: Integer]: TMenuItem;
__property TMenuItem Items[int Index];
Use Items to access to a subitem by its position in the list of subitems. The value of Index is the position of the subitem within the Items array. For example, if an application has a File drop-down menu that contains the menu items New, Open, and Save, in that order, the expression
FileMenu.Items[2]
FileMenu->Items[2]
refers to the Save command.
Delphi Examples:
{ The following code disables all the subitems of of the menu item File1. This example requires a button, a TMainMenu with several menu items added, one of them named File1. } procedure TForm1.DisableSubItemsClick(Sender: TObject); var I: Integer; begin for I := 0 to File1.Count - 1 do File1.Items[I].Enabled := False; end; procedure TForm1.Edit1Click(Sender: TObject); begin ListBox1.Items.Add('This is the Edit command'); end; procedure TForm1.File1Click(Sender: TObject); begin ListBox1.Items.Add('This is the File command'); end; procedure TForm1.FileSub11Click(Sender: TObject); begin ListBox1.Items.Add('This is the FileSub1 command'); end; procedure TForm1.FileSub21Click(Sender: TObject); begin ListBox1.Items.Add('This is the FileSub2 command'); end; procedure TForm1.FileSub31Click(Sender: TObject); begin ListBox1.Items.Add('This is the FileSub3 command'); end; procedure TForm1.Options1Click(Sender: TObject); begin ListBox1.Items.Add('This is the Options command'); end;
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|