ItemCount in a TMenuItem
Posted on 1998-06-17
A simple question...
I am using D1 and WFW 3.11. Can someone please tell me what is wrong in the following procedure. It won't accept ItemCount as a property of the TMenuItem, but in the help file the example shows it should. I have created the MenuItem(s) at runtime and want to check/uncheck items when clicked by the user. (So that only the latest clicked item is checked). If I use Count instead of ItemCount it is accepted but always gives a value of 0.
procedure TForm1.NewItemClick(Sender: TObject);
var FName: String; N: Integer; ThisItem: TMenuItem;
ThisItem := TMenuItem.Create(File1);
FName := TMenuItem(Sender).Name;
For N := 0 to ThisItem.ItemCount-1 do ThisItem.Items[N].Checked := False;
TMenuItem(Sender).Checked := True;