FMX 2.0. Global change default platform style without using TStyleBook

By: Yaroslav Brovin

Abstract: Small article about how globally to replace or add standard platform styles in FireMonkey 2.0 without use additional date of modules and TStyleBoo

 This is a repost of a blog post. If you have comments, please comment on the original blog post at http://blogs.embarcadero.com/yaroslavbrovin/2012/10/29/fmx-20-global-change-default-platform-style-without-using-tstylebook/

    FMX 2.0. Global change default platform style without using TStyleBook

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:

  1. How i can add style to standart style?
  2. How i can replcae default platform style for Windows and Mac OS
  3. 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 :-)

    It is a little theory

Firemonkey already has some platform’s styles resources. It consists:

  1. Style for Windows 7 - win7style
  2. Style for Windows 8 - win8style
  3. Style for Mac OS - lionstyle
  4. 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 (win7stylewin8stylelionstylelion2xstyle)

    Decision

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.

    Postcondition

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,win8stylelionstylelion2xstyle)

For example, when adding in the resource project for MacOS without Retina support.

Application becomes such:

Posted by ybrovin on October 29th, 2012 under Firemonkey (ENG) | 

Server Response from: ETNASC02