Jump to content
Sonjli

FMX Default style in TStyleBook

Recommended Posts

Hi,

I search for this topic all along the forum without success, so I ask here hoping someone answer me...

  1. I make a simple one form application in FMX (HD form, not 3D)
  2. I add TStyleBook
  3. Set the UseStyleManager := True
  4. Download a style from GetIt (for me "Stellar")
  5. Double click on SB
  6. Open the style editor
  7. Load the (Android) stellar style
  8. First question: The stellar style has a file .style for every platform, why? I want one style for all platforms
  9. I copy and paste the Android platform style to the default style and delete the android one
    1. Here for many times, when I close and reopen the project the IDE says "Android style not found"... why?
  10. I start the app in Win32: every form is perfectly styled
  11. I start the app in Android: all messed up
    1. No controls at all or, sometimes, default android style, why?
  12. If I re-add the android platform to style then Android goes well
  13. Windows platform uses the "windows" style if present, else the "default" style
  14. Android platform uses the "android" style if present or nothing. The default style is not taken at all

I have D11.3, Android 11/12/13 on some oppo phones.

That is.

 

This is a stackoverflow thread from the well known Dalija Prasnikar mvp:

 

https://stackoverflow.com/questions/61534033/what-is-the-purpose-of-the-default-platform-marker-in-the-list-of-tstylebook-s

 

Thanks for any help

Eddy

 

Share this post


Link to post

as you should know, each "enviroment" is distinct in many aspect!!! then, needs a particular approach for it!

VCL and FireMonkey are distinct too! then, needs an particular approach too!

before, the style was a "binary" file, now is a 'text".. you can open "*.style" file in your notepad and see for yourself!

you'll see this line:

Quote

Android

    PlatformTarget = '[ANDROID][DARKSTYLE][DEFINEFONTSTYLES]'
    MobilePlatform = True

==========

Window

    PlatformTarget = '[MSWINDOWS][MODERN][DEFINEFONTSTYLES]'
    MobilePlatform = False

for sure, internally, the "flag" will be used to special processing.

if exists so much possibility, why put all in the same place? 

 

Is TImage in VCL the same as TImage in FMX?
And why not? Are there any technical or design reasons?

Edited by programmerdelphi2k

Share this post


Link to post

for FMX form with 2 platform (MSWindows and Android) style defined = a TImage empty!!!

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 480
  ClientWidth = 640
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  object StyleBook1: TStyleBook
    Styles = <
      item
        ResourcesBin = {
          464D585F5354594C4520322E3501060B496D616765315374796C650246005450
          46300654496D61676500095374796C654E616D65060B496D616765315374796C
          650E4D756C74695265734269746D61700E01000005416C69676E070643656E74
          65720000}
      end
      item
        Platform = 'AndroidL Light'
        ResourcesBin = {
          464D585F5354594C4520322E3501060B496D616765315374796C650246005450
          46300654496D61676500095374796C654E616D65060B496D616765315374796C
          650E4D756C74695265734269746D61700E01000005416C69676E070643656E74
          65720000}
      end>
    Left = 176
    Top = 152
  end
end

 

Edited by programmerdelphi2k

Share this post


Link to post

I understand. I opened a .style (thanks, I didn't know now they are text...) and found the "target". It is clear.

So this means that is always better to keep separated TStyleBook for different platforms or maybe always to have separated platforms in a TStyleBook.

This also means that "default" platform is pretty useless... do you agree with me?

Share this post


Link to post

I think that by design, Embarcadero do it to minimize all compleXity between platforms... if was possible.

then, you need just 1 TStyleBook to many "items" (platform flags) definitions in the same place (screen). be to load or define it on designtime (or same in creating on runtime,complicate but possible I has tryed and it's works) each one with its particularity...

if "I agree" or not, does not matters, at all.

if it's ok for you, it's ok! else, ... 

 

at end, for while, it's that way! maybe change someday. as usual.

Edited by programmerdelphi2k

Share this post


Link to post

To respond to question point 8. There are one style for each platform because doing this you reduce size of the app.

In your case, my usage is to create one data module per platform and using IFDEF$ clause on each data module a Stylebook corresponding to platform, all the Stylebook have UseStylemanager=true.

 

Share this post


Link to post

not necessarily decrease the size of the final binary code, but rather meet the needs of each target platform.

consequently, it can decrease or increase the final code.

 

regarding the use of directives, it is something positive.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×