Disable a main menu item doesn't disable subitems

Hi,

I have a main menu with items. Each item has some subitems. The subitems
are linked by actions with buttoms on a toolbar. If I disable a main
menu item the subitems are not automatically disabled (I tested it!).
How can I achieve that the actions of the subitems are disabled and
therefore corresponding buttons on the toolbar too?

The following code works but is there no better and easier solution? Is
my design wrong?

procedure TForm1.SwitchAllItems(var MenuItem: TMenuItem);
var
   i: integer;

begin
    with MenuItem do
     for i:=0 to Count-1 do
      if Assigned(Items[i].Action) then
       TAction(Items[i].Action).Enabled := Enabled
end;

Kind regards,

Rolf

--
----------------------------------------------------------------
Rolf Fankhauser, PhD
ETHZ - Federal Institute of Technology Zurich
Institute of Hydromechanics and Water Resources Management
Urban Water Management Division
HIL G 31.3
CH-8093 Zuerich-Hoenggerberg
Switzerland
Tel. +41-1-633 25 07
Fax. +41-1-633 10 61