The method you're using to load the style, i.e. overriding GetStyleObject is used by component vendors because it makes installing and using their components much easier for the end user. Indeed it can be a useful way to deploy your own components once you've finished developing them, since it works around some inadequacies in the management of styles by FireMonkey. However, it also bypassed some of the default behaviours of the styling system which are very useful when developing and editing styles.
Normally FireMonkey searches the active style and any style books for a suitable style based on the components class name or StyleLookup property. The code you're using loads it's style directly from a resource and ignores anything in the active style and style books, although it preserves the default behaviour if a StyleLookup is set.
In order to edit a style you will need to load it into a style book component. Firstly you'll need to wrap the style in a TLayout,
object TLayout
...Your style here
end
(don't worry about the indentation).
You can now double click your style book and open the file.
Set the StyleName of your style (the 'root' object of it) by taking the class name of your component, removing the T and appending 'style'. E.g. TMyEdit would become 'myeditstyle'.
Comment out your GetStyleObject routine and your component should pick up the style.
Now you come to the problem of deployment.
- You can revert to the GetStyleObject method.
- You can load the style into a style book on every form you want to use it on.
- You can create a global style book and point the StyleBook property of every form to it (make sure you nil the property before you free each form).
- You can edit the default style you are using to include it (not possible with system styles).
- Or, a method I've not yet tried to inject your style elements into the active style by setting your style element's Parent to the object returned by TStyleManager.ActiveStyle.