1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| type
TForm1 = class(TForm)
protected
procedure MenuSetTrueForAll;
procedure MenuSetFalseForAll;
procedure MenuSet(const aMenus: array of TMenuItem; const aValue: boolean = true);
procedure MenuSwapAll;
procedure MenuSwap(const aMenus: array of TMenuItem);
public
end;
procedure TForm1.MenuSetTrueForAll;
begin
MenuSet([Menu1, Menu2, Menu3, Menu4, Menu5, Menu6]);
end;
procedure TForm1.MenuSetFalseForAll;
begin
MenuSet([Menu1, Menu2, Menu3, Menu4, Menu5, Menu6], false);
end;
procedure TForm1.MenuSet(const aMenus: array of TMenuItem; const aValue: boolean = true);
var N: integer;
begin
for N := Low(aMenus) to high(aMenus) do
aMenus[N].Checked := aValue;
end;
procedure TForm1.MenuSwapAll;
begin
MenuSet([Menu1, Menu2, Menu3, Menu4, Menu5, Menu6]);
end;
procedure TForm1.MenuSwap(const aMenus: array of TMenuItem);
var N: integer;
begin
for N := Low(aMenus) to high(aMenus) do
aMenus[N].Checked := not aMenus[N].Checked;
end; |
Partager