I am writing a memo component that should look like an old-fashioned terminal. It should be really simple, but the work of FireMonkey styles seems incredibly complex.
In the non-mobile FireMonkey application, I can right-click the control and select "Edit Custom Style." This option is not available in mobile applications. Here is the reason given by one of the FireMonkey developers.
This is a different style support on iOS and Android. We cannot run an Android app in the iOS style. But when you try to change the platform style, we will automatically use it on each target platform. If you want to change the default fm style, you must either put on a style book style and make a style in it, or load a platform style in the style book and make changes to it.
It is also very important that when you load the platform style into the style book, you may require that the application instance does not have two copies of the platform style (one is the system in the fmx package and the other copy in your style book). To do this, you must set the true flag in TStylebook.UseStyleManager. In this style of style, the style book will replace the platform style.
OK, so I think I need to create my own style. How do I create my own style to override only font and background properties?
I think I can redefine the ApplyStyle procedure like this.
procedure TMyMemo.ApplyStyle; var BackgroundObject: TFmxObject; begin inherited; BackgroundObject := FindStyleResource('content'); if Assigned(BackgroundObject) then begin // Change the background color of the background end; end;
How do I know what type of background object and property I need to change?
Of course, changing the background color of a control cannot be that difficult! Did I miss something fundamental with FM styles?
source share