Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!
Ad Blocking Detected
Please consider disabling your ad blocker for our website.
We rely on these ads to be able to run our website.
You can of course support us in other ways (see Support Us).
Lazarus Pascal - Determine macOS version
Delphi, Lazarus, Free Pascal
(@hans)
Famed Member Admin
Joined: 10 years ago
Posts: 2549
Topic starter
April 14, 2021 11:39 AM
Here an example on how I retrieve the macOS version info for my projects ...
Maybe it is useful for someone out there, as I did get this question and made a small example project for it.
Don't forget:
- {$modeswitch objectivec1}
- uses CocoaAll
unit Unit1;
{$mode objfpc}{$H+}
{$modeswitch objectivec1}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, CocoaAll;
type
{ TForm1 }
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
Label1.Caption := NSProcessInfo.ProcessInfo.operatingSystemVersionString.UTF8String;
Label2.Caption := IntToStr( NSProcessInfo.ProcessInfo.OperatingSystemVersion.majorVersion ) + '.' +
IntToStr( NSProcessInfo.ProcessInfo.OperatingSystemVersion.minorVersion ) + '.' +
IntToStr( NSProcessInfo.ProcessInfo.OperatingSystemVersion.patchVersion );
end;
end.
Ad Blocking Detected
Please consider disabling your ad blocker for our website.
We rely on these ads to be able to run our website.
You can of course support us in other ways (see Support Us).