Hi,

The method below will do it. However if you have OnUpdate handlers
that modified the enabled state of an action they will take priority.

procedure DisableActions(ActionList: TCustomActionList);
var
  LAction: TContainedAction;
begin
  if ActionList = nil then
    exit;
  for LAction in ActionList do
  begin
    if LAction is TCustomAction then
      TCustomAction(LAction).Enabled := False;
  end;
end;

FWIW, it isn't until a TContainedAction grows up to become a
TCustomAction that it gets an enabled property.

cheers,
Jeremy

On Tue, Apr 29, 2008 at 6:47 PM, Malcolm Clark <[EMAIL PROTECTED]> wrote:
> I'm probably having a bad day but I can't figure out how to change the
> "Enabled" property of all TAction's in a TActionList without specifying
> each TAction explicitly.
> TActionList doesn't have an "Enabled" property. So I reasoned that it
> must be possible to reiterate through the list of TAction's owned by the
> TActionList somehow or another and fix the change in eg a "for" loop.
> But I haven't found it:-)
>
> Can anyone help me?
>
> -Malcolm
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to