Showing posts with label fmx. Show all posts
Showing posts with label fmx. Show all posts

Saturday, July 26, 2025

💾 A 35-Year-Old Turbo Pascal Program Gets a Delphi 11.3 FMX Facelift

 Back in 1989, while stationed at MCAS Cherry Point as a U.S. Marine, I wrote a debt reduction program using Turbo Pascal. I called it Zilch. It was a side project—a DOS program to help people get out of debt faster by applying logic and structure to their monthly payments.

What I didn’t expect was that the program would still be alive 35 years later… and that I’d be rewriting it in Delphi 11.3 FMX to run natively on both Windows and macOS.

Today that same program—has helped over 16,000 people eliminate more than $114 million in debt. It’s been featured on Good Morning America, profiled in Military Lifestyle magazine, and used by people from all walks of life who just wanted a fair shot at financial freedom.

Turbo Pascal 1991 (640 x 480)


Delphi 5 2000 (640 x 480)


Delphi 5 2019 (640 x 480)


Delphi 11.3 FMX 2025 (Light)


Delphi 11.3 FMX 2025 (Dark)

🧰 Rewriting It with Delphi 11.3 FMX

After years of maintaining a Windows-only VCL version, I finally gave the software a full FireMonkey makeover. The new version runs beautifully on 64-bit Windows and macOS, thanks to Delphi’s powerful cross-platform capabilities.

Here’s what I used:

  • Delphi 11.3 Alexandria (FMX)

  • SQLite for local embedded storage

  • FastReport FMX for printable reports

  • Pure native code — no external dependencies, no subscriptions, no nonsense

I designed the UI using nested TLayout structures with TRectangle backgrounds and TLabel overlays for text. Simple. Clean. Predictable. Just the way I like it.

📣 Hoping to Share This Story Wider

I recently sent out a press release titled:

“Veteran’s 34-Year-Old Software Quietly Wipes Out $114M in Debt”


I'm hoping it catches the attention of journalists—not because it's flashy, but because it's quietly helped people get out of debt with logic, structure, and a clear plan.

But if the story does spread, I want the Delphi community to know this moment belongs to all of us.

I didn't build this alone.

🙏 Thank You, Delphi Community

I want to take a moment to thank the developers and authors who helped me along the way—people whose work made this possible, directly or indirectly:

  • Jeff Duntemann, whose Complete Turbo Pascal (1989) was my original gateway into programming. Without that book, none of this would have happened.

  • Ray Konopka, for his generous email responses and beautifully structured coding guidance. His style continues to shape how I write and organize code.

  • Cary Jensen, for his FireDAC and database wisdom. Cary’s knowledge and books helped me modernize the back-end without losing the software’s soul.

  • Ian Barker, for both encouragement and that persistent (okay, desperate) nudge to add a dark theme. You were right, Ian. It looks sharp. 😉

  • Andrea Magni, for Delphi GUI Programming with FireMonkey. His insights helped me tame layouts and think more visually in FMX.

  • David Cornelius, for Fearless Cross-Platform Development with Delphi. That book gave me the confidence to finally step outside of the Windows-only box.

  • Harry Stahl, for Cross-Platform Development with Delphi 10.2 and FireMonkey, which filled in several key gaps during this transition.

  • William Meyer, for Delphi Legacy Projects. His book helped me realize where I’d been going off track from the beginning—and finally set me straight in the right direction.

To all of you—thank you. Whether it was your book, your blog, your talk, or a few kind words on Twitter or in an email… you’ve helped keep ZilchWorks alive.

🧭 Final Thoughts

I’ve always believed that code should serve people—and this project has served thousands. Not because it’s cutting edge, but because it’s clear, honest, and built to last.

Delphi made that possible.

If you’re a Delphi developer with a legacy app—or a dusty old Turbo Pascal project—you don’t have to rewrite it in something new. Sometimes, all it needs is a fresh FMX coat of paint.

Thanks for reading.

Semper Fi,
Gunny Mike
https://www.zilchworks.com




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



Sunday, February 16, 2025

Delphi Tip of the Day: FMX FastReport Text Object (TfrxMemoView)

I've been playing around with FastReport in FMX. To be honest, I've been struggling a bit. So, today I decided to go back to square one and work through the FMX documentation on the FastReport website. https://www.fast-report.com/public_download/docs/FRVCL/online/en/index.html

"The "Text" object... No Problem.
HTML-tags in the "Text" object... Doesn't work as advertised.

The "Text" object (TfrxViewMemo) is extremely powerful. It accepts simple HTML tags that lets you modify a single text field in some really cool ways. It's kind of like a mini "Rich Text" object. 

Here is a what a working example is supposed to look like:



That is one text field with multiple effects applied to separate sections:
  • Bold
  • Italic
  • Bold and Italic
  • Superscript
  • Subscript
  • Color
I ran into an issue when I followed the example to create the "Orange" text. It didn't work. The Original example from the FastReports did not turn the text orange.


Using <font color="#FF8030"> did not display the text in orange. The text between the opening and closing font tags did not display at all. Seeing that the "red" font tag worked, I tried using the color name "orange". And it worked.


I then tried using the Alpha Color of  #FFFF8030 and it also worked.


I'm glad I was able to make the FastReport example work. The text object is very powerful. I experimented with several different Delphi Color name constants and they also worked. I did run into an issue with some of the obsolete color name constants, such as MoneyGreen. The FastReport designer did not recognize "MoneyGreen" as a valid integer. It did however take the MoneyGreen HEX equivalent of #FFC0DCC0.

I decided to create a the following cheat sheet of all the font color names that FastReport text object will recognize.

Name Color HEX Code

Aliceblue

Aliceblue

#FFF0F8FF

Antiquewhite

Antiquewhite

#FFFAEBD7

Aqua

Aqua

#FF00FFFF

Aquamarine

Aquamarine

#FF7FFFD4

Azure

Azure

#FFF0FFFF

Beige

Beige

#FFF5F5DC

Bisque

Bisque

#FFFFE4C4

Black

Black

#FF000000

Blanchedalmond

Blanchedalmond

#FFFFEBCD

Blue

Blue

#FF0000FF

Blueviolet

Blueviolet

#FF8A2BE2

Brown

Brown

#FFA52A2A

Burlywood

Burlywood

#FFDEB887

Cadetblue

Cadetblue

#FF5F9EA0

Chartreuse

Chartreuse

#FF7FFF00

Chocolate

Chocolate

#FFD2691E

Coral

Coral

#FFFF7F50

Cornflowerblue

Cornflowerblue

#FF6495ED

Cornsilk

Cornsilk

#FFFFF8DC

Crimson

Crimson

#FFDC143C

Cyan

Cyan

#FF00FFFF

Darkblue

Darkblue

#FF00008B

Darkcyan

Darkcyan

#FF008B8B

Darkgoldenrod

Darkgoldenrod

#FFB8860B

Darkgray

Darkgray

#FFA9A9A9

Darkgreen

Darkgreen

#FF006400

Darkgrey

Darkgrey

#FFA9A9A9

Darkkhaki

Darkkhaki

#FFBDB76B

Darkmagenta

Darkmagenta

#FF8B008B

Darkolivegreen

Darkolivegreen

#FF556B2F

Darkorange

Darkorange

#FFFF8C00

Darkorchid

Darkorchid

#FF9932CC

Darkred

Darkred

#FF8B0000

Darksalmon

Darksalmon

#FFE9967A

Darkseagreen

Darkseagreen

#FF8FBC8F

Darkslateblue

Darkslateblue

#FF483D8B

Darkslategray

Darkslategray

#FF2F4F4F

Darkslategrey

Darkslategrey

#FF2F4F4F

Darkturquoise

Darkturquoise

#FF00CED1

Darkviolet

Darkviolet

#FF9400D3

Deeppink

Deeppink

#FFFF1493

Deepskyblue

Deepskyblue

#FF00BFFF

Dimgray

Dimgray

#FF696969

Dimgrey

Dimgrey

#FF696969

Dodgerblue

Dodgerblue

#FF1E90FF

Firebrick

Firebrick

#FFB22222

Floralwhite

Floralwhite

#FFFFFAF0

Forestgreen

Forestgreen

#FF228B22

Fuchsia

Fuchsia

#FFFF00FF

Gainsboro

Gainsboro

#FFDCDCDC

Ghostwhite

Ghostwhite

#FFF8F8FF

Gold

Gold

#FFFFD700

Goldenrod

Goldenrod

#FFDAA520

Gray

Gray

#FF808080

Green

Green

#FF008000

Greenyellow

Greenyellow

#FFADFF2F

Grey

Grey

#FF808080

Honeydew

Honeydew

#FFF0FFF0

Hotpink

Hotpink

#FFFF69B4

Indianred

Indianred

#FFCD5C5C

Indigo

Indigo

#FF4B0082

Ivory

Ivory

#FFFFFFF0

Khaki

Khaki

#FFF0E68C

Lavender

Lavender

#FFE6E6FA

Lavenderblush

Lavenderblush

#FFFFF0F5

Lawngreen

Lawngreen

#FF7CFC00

Lemonchiffon

Lemonchiffon

#FFFFFACD

Lightblue

Lightblue

#FFADD8E6

Lightcoral

Lightcoral

#FFF08080

Lightcyan

Lightcyan

#FFE0FFFF

Lightgoldenrodyellow

Lightgoldenrodyellow

#FFFAFAD2

Lightgray

Lightgray

#FFD3D3D3

Lightgreen

Lightgreen

#FF90EE90

Lightgrey

Lightgrey

#FFD3D3D3

Lightpink

Lightpink

#FFFFB6C1

Lightsalmon

Lightsalmon

#FFFFA07A

Lightseagreen

Lightseagreen

#FF20B2AA

Lightskyblue

Lightskyblue

#FF87CEFA

Lightslategray

Lightslategray

#FF778899

Lightslategrey

Lightslategrey

#FF778899

Lightsteelblue

Lightsteelblue

#FFB0C4DE

Lightyellow

Lightyellow

#FFFFFFE0

Lime

Lime

#FF00FF00

Limegreen

Limegreen

#FF32CD32

Linen

Linen

#FFFAF0E6

Magenta

Magenta

#FFFF00FF

Maroon

Maroon

#FF800000

Mediumaquamarine

Mediumaquamarine

#FF66CDAA

Mediumblue

Mediumblue

#FF0000CD

Mediumorchid

Mediumorchid

#FFBA55D3

Mediumpurple

Mediumpurple

#FF9370DB

Mediumseagreen

Mediumseagreen

#FF3CB371

Mediumslateblue

Mediumslateblue

#FF7B68EE

Mediumspringgreen

Mediumspringgreen

#FF00FA9A

Mediumturquoise

Mediumturquoise

#FF48D1CC

Mediumvioletred

Mediumvioletred

#FFC71585

Midnightblue

Midnightblue

#FF191970

Mintcream

Mintcream

#FFF5FFFA

Mistyrose

Mistyrose

#FFFFE4E1

Moccasin

Moccasin

#FFFFE4B5

Navajowhite

Navajowhite

#FFFFDEAD

Navy

Navy

#FF000080

Oldlace

Oldlace

#FFFDF5E6

Olive

Olive

#FF808000

Olivedrab

Olivedrab

#FF6B8E23

Orange

Orange

#FFFFA500

Orangered

Orangered

#FFFF4500

Orchid

Orchid

#FFDA70D6

Palegoldenrod

Palegoldenrod

#FFEEE8AA

Palegreen

Palegreen

#FF98FB98

Paleturquoise

Paleturquoise

#FFAFEEEE

Palevioletred

Palevioletred

#FFDB7093

Papayawhip

Papayawhip

#FFFFEFD5

Peachpuff

Peachpuff

#FFFFDAB9

Peru

Peru

#FFCD853F

Pink

Pink

#FFFFC0CB

Plum

Plum

#FFDDA0DD

Powderblue

Powderblue

#FFB0E0E6

Purple

Purple

#FF800080

Red

Red

#FFFF0000

Rosybrown

Rosybrown

#FFBC8F8F

Royalblue

Royalblue

#FF4169E1

Saddlebrown

Saddlebrown

#FF8B4513

Salmon

Salmon

#FFFA8072

Sandybrown

Sandybrown

#FFF4A460

Seagreen

Seagreen

#FF2E8B57

Seashell

Seashell

#FFFFF5EE

Sienna

Sienna

#FFA0522D

Silver

Silver

#FFC0C0C0

Skyblue

Skyblue

#FF87CEEB

Slateblue

Slateblue

#FF6A5ACD

Slategray

Slategray

#FF708090

Slategrey

Slategrey

#FF708090

Snow

Snow

#FFFFFAFA

Springgreen

Springgreen

#FF00FF7F

Steelblue

Steelblue

#FF4682B4

Tan

Tan

#FFD2B48C

Teal

Teal

#FF008080

Thistle

Thistle

#FFD8BFD8

Tomato

Tomato

#FFFF6347

Turquoise

Turquoise

#FF40E0D0

Violet

Violet

#FFEE82EE

Wheat

Wheat

#FFF5DEB3

White

White

#FFFFFFFF

Whitesmoke

Whitesmoke

#FFF5F5F5

Yellow

Yellow

#FFFFFF00

Yellowgreen

Yellowgreen

#FF9ACD32

Osolete Color Names Use HEX Code

LtGray

LtGray

#FFC0C0C0

MedGray

MedGray

#FFA0A0A0

DkGray

DkGray

#FF808080

MoneyGreen

MoneyGreen

#FFC0DCC0

LegacySkyBlue

LegacySkyBlue

#FFF0CAA6

Cream

Cream

#FFF0FBFF



Enjoy!
Semper Fi
Gunny Mike

Saturday, July 13, 2024

Delphi Tip of the Day: Always Use the MenuBar for FMX Desktop Applications

A couple months ago, I watch the video replay "The fundamental secrets of good UI design" done by Ian Barker. Around the 33:15 mark, Barker talks about supporting "dark mode", have a listen:

Transcript:

"One of the things you really should do at a very bare minimum if you do nothing else please support dark mode. And this is kind of a personal beg from me. As I said before I do get these floaters in my eyes, I can see perfectly well you know, I'm not blind or anything like that. I'm shortsighted which is why I have glasses but if you support dark mode you will make my life a lot easier. And other people that have visual  issues as well some people get migraines and things like that dark mode helps."

https://www.youtube.com/live/TL2YVio_eTo?si=GUzsPoZriiIdyfbj&t=1995

I never considered supporting dark mode

Until I watched this video, I never considered supporting dark mode in the current rewrite of my Zilch software. So I began looking into how to incorporate FMX styles. It was confusing at first. Then I got the hang of it. I decided to go with the "Air.Style" that comes with Delphi.

David Cornenelius' book "Fearless Cross-Platform Development with Delphi" and Andrea Magni's book "Delphi GUI Programming with Delphi" were big helps understanding FMX styles.

There were a couple of tweaks I had to make. The Air.Style is a vector style which means it does not use the bitmap designer. It is similar to how Cascading Style Sheets are used in web development. The graphic elements are drawn using SVG paths. 

FMX Main Menu component can't be styled 

The biggest surprise was the TMainMenu component. It turns out the FMX Main Menu component can't be styled. The Embarcadero FMX Style Viewer was showing a Main Menu that was styled how come my Main Menu wasn't styled?

fmx-style-viewer-air
FMX Style Viewer - Air.Style

I didn't want my application to have some stuff styled and some stuff not styled. Then I discovered FMX includes a MenuBar component which does take styling. And that is what is used by the FMX Style Viewer. So, I slowly and methodically swapped out the MainMenu component for the MenuBar component.

Always use the MenuBar for FMX desktop applications


FMX MainMenu vs MenuBar

My recommendation is to skip using the MainMenu component when developing FMX desktop applications and ALWAYS use the MenuBar component.

You will be happy. Your customers will be happy.

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




Sunday, March 24, 2024

FastReport VCL & FMX Comparison (Embarcadero Edition)

Disclaimer: This post contains affiliate links, which means I may earn a small commission if you click through and make a purchase, at no extra cost to you. Your support helps keep this blog running – thank you!

The upgrade of my flagship product from Delphi 5 VCL to Delphi 11.3 FMX is finally at the presentation stage. I've spent the last six weeks thinking about and learning about data visualization. 


I took a few classes on LinkedIn Learning about data viz, and I re-watched Ray Konopka's excellent video on Data Visualization using Delphi. Seeing is Believing - Data Visualization in Multi-Device Apps. Ray has also made the source code for his demonstration available at https://delphibydesign.com/downloads/ Thank you Ray!

I've never used FastReport before. My current Delphi 5 VCL product uses QuickReports. I did find a great FastReport video available through Embarcadero Academy called Getting Started with FastReport by Cary Jensen. Jensen mainly focuses on the VCL version of FastReport. 

I've never used FastReport before 

I was surprised at the huge difference between the VCL and FMX versions of the FastReport Embarcadero Editions. That's probably why Jensen focused on the VCL version in his video. These are the palette entries for Delphi 11.3 Professional. (VCL on the left, FMX on the right)

I'm interested in the FMX version of FastReport because I'm developing a desktop software product which targets Windows and macOS users. Because I'm new to FastReport, I want to see how far I can take the "Embarcadero" version of FastReport before I commit to purchasing the full version.

Unfortunately, the Embarcadero Edition of FMX FastReport has no export capability. See the Palette image above.

I was surprised at the huge difference between the VCL and FMX versions

Because I'm targeting both Windows and macOS users I need to know if there are any stark differences between those platforms. I created a comparison chart which highlights these differences. This is the same data from the Fast Reports website sorted by features with missing capabilities highlighted.


Here is the same comparison which filters out any features that are unavailable across all platforms.


As you can see, the Embarcadero Edition of FastReports 2.0 FMX is very limited.


The Bottom Line: Because my application is cross-platform for both Windows and macOS, it looks like I will have to purchase the full retail version of FastReport 2.0 FMX in order to give my customers the experience they expect. 

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

Note: Some links in this post are affiliate links, meaning I may receive a small commission if you make a purchase. This helps support my work – thank you for your understanding.

Monday, January 1, 2024

How to open URLs with default applications in macOS and Windows

 I'm currently updating an old Delphi 5 Desktop VCL application to to Delphi 11.3 FMX. And one of the capabilities I want to provide is the ability to launch several webpages from within the application. I want to place a link in the main menu to my YouTube channel so customers can easily get to product videos. And there's also a link to my website in the Help > About box.



It was fairly straightforward the last time I did this using VCL because all I had to worry about was the Windows side of things. However, because I want this application to run on both Windows and macOS it presented a challenge.

The Delphi IDE won't recognize the Macapi namespace unless the target is set to MacOS 64-bit

Harry Stahl covers the COCOA API on pages 98-99 of his book Cross-Platform Development with Delphi. He also gives an example of how to use the NSWorkspace object of  Macapi.Appkit. However, he doesn't show how to setup the uses clause.

I also found a fantastic reference on stackoverflow by David Heffernan that was written in 2015. However, there are two issues with Heffernan's if you are looking for a complete answer:

  1. There is a reference to a blog post by Malcolm Groves called Opening files and URLs in default applications in OS X which is no longer available or accessible.
  2. The example doesn't tell you you need to target the MacOS 64-bit platform before the IDE will recognize Macapi namespace..
The Delphi IDE won't recognize the Macapi namespace unless the target is set to MacOS 64-bit. Shame on me for not reading up on the Embarcadero docs. Wrapping my head around how to use the  {$IFDEF MSWindows} and the {$IFDEF MACOS} was a little tricky But I eventually caught on. 

After a couple hours of going back and forth with code that worked for Windows but didn't work for macOS. And code that worked for macOS but didn't work for Windows, I finally got Heffernan's example to work.

The next step was to extract the code out of the main form and place it into it's own unit. And that is the code I'm sharing with you today. I hope you find this helpful. 



Video demonstration of the below source code

Here is the source code:

Unit1.fmx
object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Goto Website'
  ClientHeight = 238
  ClientWidth = 478
  Position = ScreenCenter
  FormFactor.Width = 320
  FormFactor.Height = 480
  FormFactor.Devices = [Desktop]
  DesignerMasterStyle = 0
  object Text1: TText
    AutoSize = True
    Cursor = crHandPoint
    Position.X = 116.000000000000000000
    Position.Y = 83.000000000000000000
    Size.Width = 246.078125000000000000
    Size.Height = 31.921875000000000000
    Size.PlatformDefault = False
    Text = 'https://zilchworks.com'
    TextSettings.Font.Size = 24.000000000000000000
    TextSettings.FontColor = claMediumblue
    OnClick = Text1Click
    OnMouseEnter = Text1MouseEnter
    OnMouseLeave = Text1MouseLeave
  end
end

Unit1.pas
unit Unit1;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects;

type
  TForm1 = class(TForm)
    Text1: TText;
    procedure Text1MouseEnter(Sender: TObject);
    procedure Text1MouseLeave(Sender: TObject);
    procedure Text1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.fmx}

uses
  u.OpenURL;

{ TForm1 }

procedure TForm1.Text1Click(Sender: TObject);
begin
  GotoWebsite(Text1.Text);
end;

procedure TForm1.Text1MouseEnter(Sender: TObject);
begin
  Text1.Font.Style :=  Text1.Font.Style + [TFontStyle.fsUnderline];
end;

procedure TForm1.Text1MouseLeave(Sender: TObject);
begin
  Text1.Font.Style :=  Text1.Font.Style - [TFontStyle.fsUnderline];
end;

end.

u.OpenUrl.pas
{
+-------------------------------------------------------------------------------
¦ Filename:    u.OpenURL Unit
¦ Author:      Michael J. Riley
¦ Website:     https://zilchworks.com
¦ YouTube:     https://www.youtube.com/@CapeCodGunny
¦ Copyright:   © 2023-2024 by Michael J. Riley. All Rights Reserved.
+-------------------------------------------------------------------------------
¦ Purpose:     Opens a url using the default browser on the users system.
¦
¦ OS:          Windows, macOS
+-------------------------------------------------------------------------------
¦ Developer References:
¦
¦ Book:        Cross-Platform Development with Delphi 10.2 & FireMonkey
¦ Author:      Harry Stahl
¦ ISBN:        https://isbnsearch.org/isbn/9781549545764
¦ Notes:       See pages 98-99.
¦
¦ Websites:    https://stackoverflow.com/q/28858392/195983
¦              https://stackoverflow.com/a/28859000/195983
+-------------------------------------------------------------------------------
¦ DISCLAIMER:
¦
¦ This source code is provided "as is" and without any warranty. Use it at your
¦ own risk. The author(s) make no guarantees or assurances regarding the
¦ correctness or functionality of the code, and disclaim any liability for
¦ damages resulting from its use.
¦
¦ It is advisable to thoroughly review and test the code before deploying it in
¦ any production environment.
¦
¦ By using this code, you agree to these terms and acknowledge that any issues
¦ arising from its use are solely your responsibility.
+-------------------------------------------------------------------------------
}
unit u.OpenURL;

interface

{$IFDEF MSWindows}
uses
  Winapi.ShellAPI,
  Winapi.Windows;
{$ENDIF}

{$IFDEF MACOS}
uses
  Macapi.AppKit,
  Macapi.Foundation,
  Macapi.Helpers;

  procedure macOSGotoWebsite(URL: string);
{$ENDIF}

  procedure GotoWebsite(URL: string);

implementation


procedure GotoWebsite(URL: string);
begin
  {$IFDEF MSWindows}
  ShellExecute(GetDesktopWindow, 'open', PChar(URL), '', '', SW_SHOWNORMAL)
  {$ENDIF}
  {$IFDEF MACOS}
  macOSGotoWebsite(URL);
  {$ENDIF}
end;

{$IFDEF MACOS}
procedure macOSGotoWebsite(URL: string);
var
  macURL: NSURL;
  macWorkspace: NSWorkspace;
begin
  macURL := TNSURL.Wrap(TNSURL.OCClass.URLWithString(StrToNSStr(URL)));
  macWorkspace := TNSWorkspace.Wrap(TNSWorkspace.OCClass.sharedWorkspace);
  macWorkspace.openURL(macURL);
end;
{$ENDIF}

end.

Enjoy!




Friday, March 24, 2023

Delphi FMX Desktop Development: Part 1

Question: Is FMX Desktop Development Worth It?

This is part 1 in a series dedicated to Delphi FMX Desktop development. I am in the process of converting an old VCL application to FMX. When I first started playing around with FMX I was excited because one code base could serve up all different platforms; desktop, mobile, tablet. FMX also let's you create Windows, Mac OSX, Android, iPhone apps from that same single code base.

It wasn't until recently that I discovered one code base doesn't easily translate between desktop and mobile. So I am focused solely on creating one desktop code base for Windows and Mac OSX. This is a conscious choice on my part to stay in the desktop market. 

Over the last 32 years I have had several Mac OSX users asking me when I would have a version of my software that would work on their computers. Delphi FMX will let me make this happen. 

This leads to a series of questions:

  • What does the desktop market share look like?
  • How many new Mac customers will this bring me?
  • Is it worth the effort to create a desktop application for both Windows and Mac?
  • How does geographical location influence the decision?

I would like to thank the people at statcounter GlobalStats for providing the information in this post. Visit https://gs.statcounter.com/ for more information.


"The Whole World's Gone Mobile!
Forget Desktop Development."



Let's start by looking at the Desktop vs Mobile vs Tablet market share. We are going to look at the past year and then look at the past ten years. This will show the huge growth in the mobile market.

Worldwide 1 Yr Mobile 60% Desktop 40%


Worldwide 10 Yr Mobile 16 → 60% ↑ Desktop 82 → 40% ↓  


Looking at just this one graph you would think it's a waste of time to dive into the desktop market. On a world wide scale the mobile market has completely overtaken the desktop market. At first glance you might think, "Wow, it's not worth going after the desktop market. The whole world has gone mobile." 

"I Might be Ignoring 50% of the Users!"


What about the United States? Does geography play any part in my decision to create a desktop application? After all, the majority of my customers come from the United States.

USA 1 Yr Mobile 46% Desktop 52%



USA 10 Yr Mobile 15 → 46%  Desktop 82 → 52% 


Because the majority of my customers are from the United States, and I'm only concerned with the Desktop market share, what do these numbers tell me?

Today, the Desktop market share in the United States is 52%. This tells me that 5 out of every 10 potential customers are desktop users. This also tells me that mobile use has skyrocketed over the past ten years, and my decision to only focus on desktop might be ignoring almost 50% of the users.

What about my decision to only focus on Windows and Mac OSX customers?

USA 10 Yr Windows 82 → 60% OSX 16 → 30%↑   

Here is what the Desktop Operating System landscape tells me looking at the past ten years. Windows is still the dominant operating system within the USA even though it has dropped 22%. On the other hand Mac OSX has almost doubled it's share of the market.

Overall, the prospects look good to invest some solid time and effort into creating a Desktop application that caters to both Windows and Mac users. As far as how many Mac OSX customers can I expect? 

These numbers tell me I can expect about 5 new Mac OSX customers for every 10 new Windows customers. And that sounds pretty good to me. 

Answer: It's worth it for me!

Use this link for all 32 videos from the Desktop First UX Summit 2021
https://www.youtube.com/playlist?list=PLDWPwIbHH6jldMmNDe99y9NDWiEl-B3jK

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