Sonjli 6 Posted March 8, 2023 Hi, I search for this topic all along the forum without success, so I ask here hoping someone answer me... I make a simple one form application in FMX (HD form, not 3D) I add TStyleBook Set the UseStyleManager := True Download a style from GetIt (for me "Stellar") Double click on SB Open the style editor Load the (Android) stellar style First question: The stellar style has a file .style for every platform, why? I want one style for all platforms I copy and paste the Android platform style to the default style and delete the android one Here for many times, when I close and reopen the project the IDE says "Android style not found"... why? I start the app in Win32: every form is perfectly styled I start the app in Android: all messed up No controls at all or, sometimes, default android style, why? If I re-add the android platform to style then Android goes well Windows platform uses the "windows" style if present, else the "default" style 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
programmerdelphi2k 237 Posted March 8, 2023 (edited) 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 March 8, 2023 by programmerdelphi2k Share this post Link to post
programmerdelphi2k 237 Posted March 8, 2023 (edited) 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 March 8, 2023 by programmerdelphi2k Share this post Link to post
Sonjli 6 Posted March 8, 2023 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
programmerdelphi2k 237 Posted March 8, 2023 (edited) 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 March 8, 2023 by programmerdelphi2k Share this post Link to post
Serge_G 87 Posted March 21, 2023 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
programmerdelphi2k 237 Posted March 21, 2023 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