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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| procedure bsMerge(MainMenu,MenuToMerge: TMainMenu);
function GroupIndexPos (aIndx: integer): integer;
var
i: integer;
stop: boolean;
begin
result := -1;
stop := false;
i := 0;
while (i < MainMenu.Items.Count) and (not stop) do
begin
if (MainMenu.Items[i].GroupIndex > aIndx) then
begin
stop := true;
result := i;
end;
inc(i);
end;
end;
var
i, idx : integer;
aIt: TMenuItem;
Ct: integer;
begin
Ct := MenuToMerge.Items.count;
for i:=0 to pred(ct) do
begin
aIt := MenuToMerge.Items[0];
idx := GroupIndexPos(ait.GroupIndex);
MenuToMerge.Items.delete (0);
if idx = -1 then
MainMenu.Items.Add (aIt)
else
begin
if MainMenu.Items[idx].Caption = aIT.Caption then
begin
end;
MainMenu.Items.Insert (idx,aIt);
end;
end;
end;
procedure bsUnMerge(MainMenu, MenuToMerge: TMainMenu);
{ Un merge les element de MainMenu dont le Owner est le owner du MenuAMerge }
var
i : integer;
aIt: TMenuItem;
begin
i := 0;
while (i < MainMenu.Items.count) do
begin
aIt := MainMenu.Items[i];
if aIt.Owner = MenuToMerge.Owner then
begin
MainMenu.Items.delete (i);
MenuToMerge.Items.Add (aIt);
end
else
inc(i);
end;
end; |
Partager