
- Код: Выделить всё
procedure DisablePopupMenuInAll;
var
FormCount,Iterations:Cardinal;
FalsePopup:TPopupMenu;
begin
FalsePopup:=TpopupMenu.Create(nil);
for FormCount:=0 to Application.ComponentCount-1 do
begin
for Iterations:=0 to (Application.Components[FormCount] as Tform).ComponentCount-1 do
begin
((Application.Components[FormCount] as Tform).Components[Iterations] as Tcontrol).PopupMenu:=FalsePopup;
end;
end;
end;
Отключает на всех формах проекта ( на тех , которые создаются как Application.CreateForm ...
применима вот так :
- Код: Выделить всё
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
{ ... много много форм проекта...}
{Application.CreateForm(TFormN, FormN);}
{ попуп меню везде отключается }
DisablePopupMenuInAll;
Application.Run;