procedure TForm1.Action1Execute(Sender: TObject);
const
CHECKED: array[boolean] of char = ('.', 'X');
var
i: Integer;
SenderAction: TAction;
ac: TAction;
c: TComponent;
begin
if Sender = nil then
exit;
SenderAction := Sender as TAction;
c := SenderAction.ActionComponent;
for i := 0 to ActionList1.ActionCount-1 do
if (ActionList1.Actions[i] is TAction) then
begin
ac := TAction(ActionList1.Actions[i]);
if ac.GroupIndex = SenderAction.GroupIndex then
begin
ac.Checked := (ac = SenderAction);
if ac.Checked and (c is TToolButton) then
TToolButton(c).Down := true;
end;
end;
Label1.Caption := CHECKED[Action1.Checked] + CHECKED[Action2.Checked] + CHECKED[Action3.Checked] + CHECKED[Action4.Checked];
Label2.Caption := CHECKED[Action5.Checked] + CHECKED[Action6.Checked] + CHECKED[Action7.Checked] + CHECKED[Action8.Checked];
end;