Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey, Delphi Android, Delphi IOS

Add Firemonkey Mobile Styles Into Your Desktop Apps In Delphi 10 Seattle For Android And IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi 10 Seattle Mobile Styles On The Desktop Android IOS OSX Windows | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSDeveloper Marcus Ja came up with a solution for displaying any Firemonkey device style on any other device in Delphi 10 Seattle. In previous versions is functionality was called Mobile Preview and allowed you to see what the IOS or Android style app would look like but in Win32. It is very similar to how IOS Simulator displays an IOS app on the desktop. This is useful because it allows you to create screenshots of your apps for all of the different devices sizes that an App Store needs. You can also see exactly how your app is going to look in IOS or Android from within your Win32 app when using the specified style. Keep in mind the only thing this is doing is skinning the Firemonkey controls with the mobile skin instead of the desktop skin. Native platform controls will still only show up as they would on the platform you are running on. These steps should work with Appmethod and C++Builder as well. Here are the steps he came up with:

1. Open the style designer (add a StyleBook to the form and double click).
2. Load the mobile style you want to use. Located in the public Style folder. It end’s with *.fsf
3. Save it to a location you prefer. (Now the file extension *.style)
4. Open the style in a text editor.
5. Search for the object TStyleDescription and delete the whole section.
6. In your project file (*.dpr) add the unit FMX.Style and at the first code line TStyleManager.SetStyleFromFile(<your style>).

If you want to use these steps with the Premium styles they are already in the .style format so you can just edit them directly without loading them into the TStyleBook first.

Here is what my sample project file looked like after implementing the code:


program Project1;
//
uses
System.StartUpCopy,
FMX.Styles,
FMX.Forms,
Unit1 in 'Unit1.pas' {Form1};
//
{$R *.res}
//
begin
TStyleManager.SetStyleFromFile('C:\Users\Anonymous\Documents\Embarcadero\iOSJet.style');
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

And here is a sample of the TStyleDescription section below which you can remove to allow styles to work on any device. As you can see the PlatformTarget shows some platform definition information. By deleting it or modifying it you can allow it to run on the other platforms.

object TStyleDescription
StyleName = 'Description'
Author =
'Embarcadero Technologies Inc.; Original Design Elements by Medi' +
'aLoot.com'
AuthorURL = 'www.embarcadero.com'
PlatformTarget = '[IOSALTERNATE][IOS7][DEFINEFONTSTYLES]'
MobilePlatform = True
Title = 'iOSJet'
Version = '1.0'
end

More information about working with Firemonkey styles and more example source code about loading your own custom styles in Delphi 10 Seattle is available over in the Delphi documentation.

Exit mobile version