0

I use Firemokey 10.2. In macOS, internally when you move your from from a normal display to a retina display it automatically changes style of the controls. I would like to stop this message which is TScaleChangedMessage. I would appreciate If you could help me how can I stop this message in my app. In other word how can I stop changing from normal styles to High-Resolution Styles

user1581036
  • 61
  • 1
  • 7

2 Answers2

0

The easiest way would be to create a copy of the FMX.Platform.Mac unit, and modify the TFMXWindow.windowDidChangeBackingProperties method so that the message is never sent, e.g:

procedure TFMXWindow.windowDidChangeBackingProperties(notification: NSNotification);
begin
//  if (Application = nil) or (Application.Terminated) then
//    Exit;
//  try
//    TMessageManager.DefaultManager.SendMessage(nil, TScaleChangedMessage.Create(Wnd), True);
//  except
//    HandleException(Self);
//  end;
end;

i.e. just comment out everything in it

Unfortunately if you're using Delphi 10.2 Update 1, it means you'll need to include all the FMX units in the project path (so that they're also recompiled), due to this issue:

https://quality.embarcadero.com/browse/RSP-18836

Dave Nottage
  • 3,411
  • 1
  • 20
  • 57
  • thanks a million, but unfortunately firemonkey still changes the style when my app runs in retina display and commenting out this method doesn't solve my problem :( – user1581036 Sep 18 '17 at 14:30
  • Your question was: "I would like to stop this message which is TScaleChangedMessage. I would appreciate If you could help me how can I stop this message in my app". I answered your question. Unless you edit your question, my answer is correct. – Dave Nottage Sep 18 '17 at 21:55
0

I found the solution, changing this function function TMacWindowHandle.GetScale: Single; begin //Result := Wnd.backingScaleFactor result := 1; end; will solve this problem :)

user1581036
  • 61
  • 1
  • 7