SubItemsEnabled (Delphi)
Description
The following code disables all the subitems of the menu item File1. This example requires a button and a TMainMenu with several menu items added, one of them named File1.
Code
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;
Uses
- Vcl.Menus.TMenuItem.Count ( fr | de | ja )
- Vcl.Menus.TMenuItem.Items ( fr | de | ja )
- Vcl.Menus.TMenuItem.Enabled ( fr | de | ja )