Sunday, December 22, 2024
HomeProductsDelphi DACDelphi XE2 FireMonkey HD Applications Raise Runtime Error 231 on Mac OS...

Delphi XE2 FireMonkey HD Applications Raise Runtime Error 231 on Mac OS X

Many users have encountered the problem when running FireMonkey HD Applications on Mac OS X without 3D hardware HAL. When this application is run, it either freezes or produces the following error:

Runtime error 231 at 000169AD

We have researched this problem and found a solution from Embarcadero.
If a Mac OS X computer has no 3D hardware HAL, you need to set the global variable FMX.Types.GlobalUseHWEffects to False. Example:

begin
  FMX.Types.GlobalUseHWEffects := False;

  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run; 
end;

However, this solution is not a panacea. Sometimes HD Applications continue to freeze or raise the error even with FMX.Types.GlobalUseHWEffects set to False. In this case, you need to modify the FMX.Filter.pas unit. Do the following:

  1. Copy the FMX.Filter.pas and FMX.Defines.inc files from the $(BDS)sourcefmx folder to your project folder.
  2. In the files copied to your project folder replace the code of the FilterByName and FilterClassByName functions with the following code:
    function FilterByName(const AName: string): TFilter; 
    var
      i: Integer;
    begin
      Result := nil;
      if not GlobalUseHWEffects or (Filters = nil) then // <-- change this line
        Exit;
      for i := 0 to Filters.Count - 1 do
        if CompareText(TFilterClass(Filters.Objects[i]).FilterAttr.Name, AName) = 0
      then
      begin
        Result := TFilterClass(Filters.Objects[i]).Create;
        Exit;
      end;
    end;
    
    function FilterClassByName(const AName: string): TFilterClass; 
    var
      i: Integer;
    begin
      Result := nil;
      if not GlobalUseHWEffects or (Filters = nil) then // <-- change this line
        Exit;
      for i := 0 to Filters.Count - 1 do
        if CompareText(TFilterClass(Filters.Objects[i]).FilterAttr.Name, AName) = 0
        then
        begin
          Result := TFilterClass(Filters.Objects[i]);
          Exit;
        end;
    end;
  3. Add the FMX.Filter unit to the USES section of your project:
    program Project1;
    
    uses
      FMX.Forms,
      FMX.Types,
      FMX.Filter, // <-- add unit
      Unit1 in 'Unit1.pas' {Form1};

After such modifications your applications will run successfully on Mac OS X without 3D hardware HAL; however, 3D effects will not be available for it.

Updated:
This trick is not required for Rad Studio XE2 with Update 3 and higher.

RELATED ARTICLES

6 COMMENTS

  1. You’re in point of fact a just right webmaster. The website loading pace is amazing. It kind of feels that you are doing any distinctive trick. Also, The contents are masterpiece. you’ve done a great task on this subject!

  2. I enjoy, cause I found just what I was looking for. You have ended my 4 day long hunt! God Bless you man. Have a great day. Bye

  3. Delphi Tokyo does the same! And the filter.pas is completely different code now, no idea what to fix.

    • Hello, Softtouch!
      We did not have similar problems on Delphi Tokyo, so it’s difficult for us to recommend something. If we find a solution to your issue, we will definitely write how to solve it.

Comments are closed.

Whitepaper

Social

Topics

Products