Small article about how globally to replace or add standard platform styles in FireMonkey 2.0 without use additional date of modules and TStyleBook.
I think many faced some questions:
- How i can add style to standart style?
- How i can replcae default platform style for Windows and Mac OS
- And etc
The task often meets and has the simple decision. But to tell about it follows, as I didn’t find the sounded decisions. A situation I correct
Firemonkey already has some platform’s styles resources. It consists:
- Style for Windows 7 – win7style
- Style for Windows 8 – win8style
- Style for Mac OS – lionstyle
- Style for Mac OS with Retina display –lion2xstyle
To the bold are specified the name of an appropriate resource of style. To replace platform style, it is enough to include in the project the file of style with one of the specified names of resources (win7style, win8style, lionstyle, lion2xstyle)
Now we will try in practice.
1. Open fire monkey project. I used demo project ControlsDemo from XE3 samples
2. Go to “Project -> Resources and Images…“
3. Append our style for Windows 7 (for example Dark.style)
4. Build and run project.
If you want to replace styles for all platforms, respectively it is necessary for you to add in the project resources of files of styles for all registered platforms (win7style,win8style, lionstyle, lion2xstyle)
For example, when adding in the resource project for MacOS without Retina support.
Application becomes such: