Search code examples
delphidelphi-xe2vcl-styles

Delphi XE2: Reloading a custom VCL style from file?


I'm loading a custom style from file using:

TStyleManager.LoadFromFile(filename)

When the file is changed I want to load it again. But if I try that I get a EDuplicateStyleException because the style is already registered.

Is there a way to unload a style so I can load it again? The typical case for this is that you are making changes to a custom style and want to see it in action without restarting the whole application.


Solution

  • After scanning the sources I guess that is not possible in a straight forward way. Your only chance might be to implement some dirty hack.

    Whatever you do, you should write a QC for this. Embarcadero could implement to reload the file if the style already exists instead of raising an exception. That would look like a natural behaviour to me.