RAD Studio VCL Reference
|
Specifies whether the menu item is enabled.
property Enabled: Boolean;
__property Boolean Enabled;
Use Enabled to enable or disable a menu item. If Enabled is true, the Click method is called when the user selects the item with the mouse. If Enabled is false, the menu item appears dimmed and the user cannot select it. However, calling the Click method works even when Enabled is false.
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!
|