for i:=1 to fmmain.MainMenu1.Items.Count-1 do begin // 主 1 it:=fmmain.MainMenu1.Items.Items; advs1.Cells[i-1,0]:=it.Caption; i1:=1; for j:=0 to it.Count-1 do begin //fu1 it1:= it.Items[j]; act1:=taction(it1.action); if it1.Action<> nil then begin if it1.Enabled then begin advs1.Cells[i-1,i1]:=act1.Caption; advs1.Objects[i-1,i1]:=it1; i1:=i1+1; end; end else begin for l:=0 to it1.Count-1 do begin it2:= it1.Items[l]; act1:=taction(it2.action); if (it2.Action<> nil) and it2.Enabled then begin advs1.Cells[i-1,i1]:=copy(it1.Caption,7,4)+':'+act1.Caption; advs1.Objects[i-1,i1]:=it2; i1:=i1+1; end; end; end; if i1>k then k:=i1; if i=1 then j1:=i1; end; //fu1 end ; //zhu 1