Thursday, March 13, 2025

Delphi FMX Air.Style Missing 'scrollboxstyle' Definition

I've been upgrading my flagship software product Zilch, from Delphi 5 VCL to Delphi 11 FMX. I'm finally in the report development phase. I'm using the FMX version of FastReports.

Things have been going along quite well, other than the typical stumbling around, which happens when learning the ins and outs of a new component suite (FastReports). 

Back in May 2024, I decided to implement a dark theme after watching Ian Barker's presentation called "The fundamental secrets of good UI design". https://www.youtube.com/live/TL2YVio_eTo

During this presentation Barker pleads with the audience to include a dark theme option because it makes life much easier for people like him. Those who suffer with severe cataracts. 

I am very meticulous about my work. Borderline obsessive. After spending nearly 4 weeks creating, tweaking, previewing, re-tweaking a report I finally decided to see what it looks like in dark mode. That's when I got hit with an access violation. 

My first reaction was WTF! 😡 


FMX.StdCtrls

I spent 3 months or more back in May 2024 testing and trying several different FMX styles. I finally settled on the Air.Style after making several customizations. And now this happens. Just when I thought I was getting close to wrapping up this project. WTF! 😡

Inside my application I'm using the StyleManager.  I call:

TStyleManager.SetStyleFromFile( <FullFilePath> )

<FullFilePath> is the full file path of the modified version of Air.Style I'm using inside my program. I remember trying Dark.Style early on but I didn't like the brownish-copper glow effect so I opted for the Air.Style.

I quickly tried setting the <FullFilePath> to Dark.Style and tested it again, IT WORKED! 😎

Okay, so there is something different between Air.Style and Dark.Style. I searched both .STYLE files looking for "TScrollBar"

It turns out that Air.Style is missing the definition for StyleName = 'scrollboxstyle'.

I copied the complete 'scrollboxstyle' definition from Dark.Style and pasted it inside Air.Style and IT WORKED!

Payoff Savings Report - Air.Style

I'm glad this was a quick fix. Here is the complete 'scrollboxstyle' definition for anyone that would like to modify the Air.Style so it works with FastReports. 

  object TLayout
    StyleName = 'scrollboxstyle'
    DesignVisible = False
    Height = 131.000000000000000000
    Position.X = 254.000000000000000000
    Position.Y = 435.000000000000000000
    Width = 334.000000000000000000
    object TLayout
      StyleName = 'background'
      Align = Contents
      Locked = True
      Height = 131.000000000000000000
      Width = 334.000000000000000000
      object TLayout
        StyleName = 'content'
        Align = Client
        Height = 115.000000000000000000
        Width = 318.000000000000000000
      end
      object TScrollBar
        StyleName = 'vscrollbar'
        Align = Right
        Height = 115.000000000000000000
        Orientation = Vertical
        Position.X = 318.000000000000000000
        Width = 16.000000000000000000
      end
      object TScrollBar
        StyleName = 'hscrollbar'
        Align = Bottom
        Height = 16.000000000000000000
        Orientation = Horizontal
        Position.Y = 115.000000000000000000
        Width = 334.000000000000000000
      end
      object TSmallScrollBar
        StyleName = 'vsmallscrollbar'
        Align = Right
        Height = 8.000000000000000000
        Orientation = Vertical
        Margins.Left = 2.000000000000000000
        Position.X = 99.000000000000000000
        Position.Y = 2.000000000000000000
        Visible = False
        Width = 8.000000000000000000
      end
      object TSmallScrollBar
        StyleName = 'hsmallscrollbar'
        Align = Bottom
        Height = 8.000000000000000000
        Orientation = Horizontal
        Margins.Top = 2.000000000000000000
        Position.X = 2.000000000000000000
        Position.Y = 113.000000000000000000
        Visible = False
        Width = 150.000000000000000000
      end
      object TLayout
        Align = Contents
        Height = 131.000000000000000000
        Width = 334.000000000000000000
        object TLayout
          Align = Bottom
          Height = 20.000000000000000000
          Position.Y = 111.000000000000000000
          Width = 334.000000000000000000
          object TSizeGrip
            StyleName = 'sizegrip'
            Align = Right
            Locked = True
            Height = 20.000000000000000000
            Position.X = 314.000000000000000000
            Width = 20.000000000000000000
          end
        end
      end
    end
  end


Update: March 16, 2025

I'll have to give the new Delph 12.3 command-line style converter tool (vsf2fm.exe) a try. Hat Tip to Ray Konopka for pointing me in this direction.


I just installed Delphi 12.3 and used the vsf2fm.exe command-line tool and converted the Carbon.vsf to Carbon.style and it works perfectly.


Update: March 18, 2025

Just tried targeting macOS and the Carbon.style looks fantastic.

Enjoy!
Semper Fi
Gunny Mike
https://zilchworks.com



No comments:

Post a Comment