I have a TActionManager on my Form.
I would like to from code at runtime be able to change the style of the Action Manager between ‘Platform Default’ ‘and XP Style’ etc.
When I try any of the below:
ActionManager1.Style := 'Platform Default';
ActionManager1.Style := 'XP Style';
I get the following error:
Left side cannot be assigned to
I can only assume this property is read-only by the error message.
Is there a workaround, or something I might be missing as to how to change the Action Manager style at runtime?
Thanks.
I’m slightly confused by the error message you report. That is not the error message that your code produces. The error message that is actually reported, for the code in your question, is:
Leaving that aside, the correct syntax for setting an action manager style at runtime is this:
Note that the
Styleproperty is of typeTActionBarStyle. There are various instances ofTActionBarStyledescendents defined in the VCL, one per registered style.These instances are all global variables defined in the interface section of a unit, one unit per instance. To gain access to these style objects you will need to
usethe following units:Vcl.PlatformDefaultStyleActnCtrlsfor thePlatformDefaultstyle.Vcl.XPStyleActnCtrlsfor theXPStylestyle.Vcl.StdStyleActnCtrlsfor theStandardStylestyle.You will need to omit the
Vclprefix on older versions of Delphi.The form designer uses a piece of magic to make the style look like a string in the Object Inspector. It has been implemented this way to make it feasible for you to register your own styles.