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 - Dark Theme

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. 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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

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



No comments:

Post a Comment