I have a TActionManager in my application, where all the actions are defined. I need to obtain a list of all its actions; currently, using its Actions property I can obtain the "path" for the action (GetNamePath) but I also want to obtain its caption.
Is it possible to obtain all actions from an action manager?
The
Actions[]property returns aTContainedActionwhich is a low-level base class. You'll need to up-cast that to an appropriate derived class. For example, if your action manager containsTActioninstances then you can do this:If you are deriving custom actions from
TCustomAction, then use that in your cast.Obviously you might want to use
isto check for the actual runtime type of the action and avoid a runtime cast error.